我有使用GridView的页面这个GridView有很多行,我的客户想要冻结Fisrt列和相应的标题,我尝试下面的代码
CSS
div#div-datagrid
{
/*style="height: 382px; overflow: scroll; width: 100%"*/
width: 100%;
height: 382px;
overflow: scroll;
/*scrollbar-base-color:#ffeaff;*/
}
/* Locks the left column */
td.locked, th.locked {
position:relative;
cursor: default;
background-color: White;
/*IE5+ only*/
left:expression(document.getElementById("div-datagrid").scrollLeft-2);
}
.CS
protected void myGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].CssClass = "locked";
e.Row.Cells[1].CssClass = "locked";
}
这在IE中运行良好,但在FF和Chrome中无效。任何解决方案?