Groups | Blog | Home
all groups > asp.net > december 2005 >

asp.net : Scrolling DataGrid


Wasco
12/13/2005 11:55:31 PM
Hi All,
somebody knows how can I implement a scrollable datagrid?
I made one used DIV tag and the tricks of a datagrid for title and
another for contents but I'm not satisfied.

Thanks!!
Holysmoke
12/14/2005 4:16:02 AM
Hi,

Insert a div tag inside DataGrid Tag with the following name "div-datagrid"

Declare a Sytle Tag something like this,

<style>
DIV#div-datagrid { OVERFLOW: auto; WIDTH: 420px; HEIGHT: 200px }
.lockrow
{
TOP: expression(document.getElementById("div-datagrid").scrollTop-2);
POSITION: relative;
}
</style>


In ItemDataBound Event of the datagrid,

If e.Item.ItemType = ListItemType.Header Then
For Each MyCell As System.Web.UI.WebControls.TableCell In
e.Item.Cells
MyCell.CssClass = "lockrow"
Next
End If




[quoted text, click to view]
AddThis Social Bookmark Button