我可以在gridview的行中添加无限制的文本框列。但在回发后这些文本框被处理掉了。那么如何在回发后保留这些文本框及其值?
代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int i = 3;
if (e.Row.RowType == DataControlRowType.DataRow)
{
crcl = (List<string>)ViewState["bdi2"];
foreach(string a in crcl)
{
TextBox TextBox101 = new TextBox();
TextBox101.ID=a;
TextBox101.Width = 60;
TextBox101.Text = (e.Row.DataItem as DataRowView).Row[a].ToString();
e.Row.Cells[i].Controls.Add(TextBox101);
//TextBox101.AutoPostBack = true;
i++;
}
}
}
答案 0 :(得分:0)