去掉GridView中自带的div

GridView在生成样式时会把Table放在<div></div>,在Div+Css布局里,这样生成出来的样式会因为div而出现混乱,我对css研究不多,所以喜欢把div去掉,这样省掉很多功夫,代码如下:

 protected override void Render(HtmlTextWriter writer)
{
if (this.Page != null)
{
this.Page.VerifyRenderingInServerForm(this);
}
this.PrepareControlHierarchy();
this.RenderContents(writer);
}

这个方法是N年前在不记得在某个高手的Blog里看到的,现在找不到了,所以发出来以供自己和他人查询

猜你喜欢

转载自blog.csdn.net/wei123456/article/details/5766419
今日推荐