后台代码方法实现:
protected void RecruitPlanInfoCreated(object sender, RepeaterItemEventArgs e)
{
Repeater detailList = e.Item.FindControl("RecruitPlanInfo") as Repeater;
if (detailList != null)
{
RecruitPlanInfo rpi = e.Item.DataItem as RecruitPlanInfo;
if (rpi != null)
{
detailList.DataSource = rpi.InfoDataTable;
detailList.DataBind();
}
}
}
19.动态实现多表头的方法
对于多表头,一般采用静态设置table的方法,但也可以在Grideview控件中动态实现。主要就是在GridView的RowCreated中,对其首行进行修改设置,示例如下:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells.Clear();
Table t = this.GridView1.Controls[0] as Table;
文章来源于领测软件测试网 https://www.ltesting.net/