ASP.NET GridView horizontal scrollbar to the top
Loading
ASP.NET GridView horizontal scrollbar to the top
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Naimish MakwanaPosted Jun 6, 2024, 9:02 AM
To add a horizontal scrollbar to the top of an ASP.NET GridView, you can use a combination of HTML and CSS. Unfortunately, there’s no built-in way to do this, but you can achieve it with a bit of custom code.
Here’s a simple example of how you can do it:
And the corresponding CSS:
In this example, the
.outerdiv creates the scrollbar at the top, and the.innerdiv contains the GridView and creates a second scrollbar at the bottom. The negative margin on the.innerdiv hides the bottom scrollbar, so only the top one is visible.Please note that this is a workaround and might not work perfectly in all situations or with all types of content. It’s always a good idea to test thoroughly with your specific GridView and content. Also, keep in mind that this might not provide the best user experience, as users are generally accustomed to scrollbars being at the bottom.
Thanks
Jayraj ChhayaPosted Jun 6, 2024, 6:22 AM
To achieve this functionality in an ASP.NET GridView, you can use JavaScript to scroll the GridView horizontally to the top.