Pages

Wednesday, February 9, 2011

Freeze the columns in Gridview

STEP 1: Add the Following CSS class to the .aspx file
<style type="CSS/Text">
td.freezecolumn{
text-align: left;
border-width:0;
position:relative;
cursor: default;
left:inherit;
}
</style>


STEP 2: Set the CSSClass property of the cells in the GridView RowDatabound event.

protected void gvData_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].CssClass = "freezecolumn";
}

No comments:

Post a Comment