1、若不想GridView 表行头字体为粗体,可以更改其属性 UserAccessibleHeader = false 即可,
若想其表行头居中可更改其属性 HorizontalAlign = center 即可。
2、在GridView数据源为空时也显示表头 首先,需要GridView的AutoGenerateColumn属性为false。 进行正常的绑定后,
添加页面事件 this.PreRender += OnPagePreRender; 这个事件只要比绑定晚就可以,不必非得是PreRender。 然后判断。
3、去除GirdView的行頭,更改showHeader屬性為false即可。
4、GridView有光标移动效果
protected void gvType_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E6F5FA'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
若想其表行头居中可更改其属性 HorizontalAlign = center 即可。
2、在GridView数据源为空时也显示表头 首先,需要GridView的AutoGenerateColumn属性为false。 进行正常的绑定后,
添加页面事件 this.PreRender += OnPagePreRender; 这个事件只要比绑定晚就可以,不必非得是PreRender。 然后判断。
3、去除GirdView的行頭,更改showHeader屬性為false即可。
4、GridView有光标移动效果
protected void gvType_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E6F5FA'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
浙公网安备 33010602011771号