后臺代碼方法實現:
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;
文章來源于領測軟件測試網 http://www.kjueaiud.com/