Tuesday, May 3, 2011

ASP.NET - Add scrollbar to GridView control

Unlike WinForm DataGridView or DataGrid in WPF, GridView control in ASP.NET does not include Scrollbar feature in it. However, adding scrollbar to GridView control isn't that difficult.
Here is one way of doing it. Add div tag with fixed width and height and set overflow to auto. (This div tag actually works with any control)
<div style="width: 500px; height: 400px; overflow:auto">  <asp:GridView ID="grid1" runat="server">  </asp:GridView>