How to create a Scroll in GridView using ASP.NET

How do I create a scroll in GridView using ASP.NET without using fixed sized div's around it like shown here http://www.aspnettutorials.com/tutorials/controls/gridviewscroll-aspnet2-csharp.aspx .

Answers


You can set the div's width or height to a percentage as well, and with overflow:auto, the div contents will scroll if the browser is sized to less than the content.

Without any size settings, your div will simply expand to hold all content, so a percentage, fixed, or inherited size in at least one dimension is required for scrolling to ever occur.


In order to get a scroll bar, you need a fixed height container with overflow set to scroll.

Whether you do it with the grid's properties, like in the example you linked, or by just wrapping it in a Panel with a height and overflow set on it, it doesn't matter much. The key thing is just to get it inside a fixed height container. How you want the UI to look (where the scrollbar is, etc.) will dictate where you create the div.


Need Your Help

Use Asp.net MVC1 or MVC 2?

asp.net-mvc asp.net-mvc-2

A project is due to be started and finished by the end of the year. It's for internal company use, will be entirely done by a single developer(me). I intend to make use of data annotations(via Step...

Convert Json data to Python DataFrame

python json pandas

This is my first time accessing an API / working with json data so if anyone can point me towards a good resource for understanding how to work with it I'd really appreciate it.