【发布时间】:2013-05-20 07:59:40
【问题描述】:
我想在网格中添加一个文本框列。我做了下面的编码。但它不起作用
var box = (TextBox)sender;
int p = int.Parse(box.Text);
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("details", typeof(TextBox)));
// dt.Columns.Add(new DataColumn("count", typeof(int)));
for (int k = 1; k <= p; k++)
{
TextBox tt = new TextBox();
tt.ID = "TT";
dr = dt.NewRow();
dr["details"] =(TextBox) tt;
// dr["count"] = string.Empty;
dt.Rows.Add(dr);
}
ViewState["CurrentTable"] = dt;
GridView1.DataSource = dt;
GridView1.DataBind();
谁能帮我做这件事? 提前致谢。
【问题讨论】: