GridView 中生成了<thead>、<tbody>标记分页时报错解决方案

来源:互联网 发布:淘宝有哪些软妹 编辑:程序博客网 时间:2024/05/17 02:56

由于项目需要,我让gridview在生成html代码时,带有<thead>、<tbody>标记,让Gridview带有此标记的代码如下:

  //protected void gvEquData_PreRender(object sender, EventArgs e)    //{        //if (gvEquData.Rows.Count > 0)        //{        //    // 使用<TH>替换<TD>        //    gvEquData.UseAccessibleHeader = true;        //    //This will add the <thead> and <tbody> elements        //    //HeaderRow将被<thead>包裹,数据行将被<tbody>包裹        //    gvEquData.HeaderRow.TableSection = TableRowSection.TableHeader;        //    // FooterRow将被<tfoot>包裹        //    gvEquData.FooterRow.TableSection = TableRowSection.TableFooter;        //}    //}

然而在Girdview中如果带有此标记,在分页时,会出现错误:“必须按以下顺序包含行节: 标题、正文和脚注。”解决方案是不使用Gridview自带的分页,而是使用第三方分页控件进行分页。如:AspNetPager

原创粉丝点击