这是我用c#编写的代码
受保护的无效发送者(object ibtCopiar_Click,ImageClickEventArgs e) {
GridViewRow grdrows = DGPlanilla.Rows[0];
TextBox tb1 = (TextBox)grdrows.FindControl("TextBox1");
string valor = tb1.Text;
if (valor != null || valor != "0")
{
foreach (GridViewRow grdrow in DGPlanilla.Rows)
{
grdrow.Cells[5].Text = valor;
}
}
}
这是我的按钮代码
当我调试时,我看到我在firts框中的值被传递给列中的其他文本框,但当它只显示页面时,第一个框显示我输入的值。其他文本框不会改变。
发布于 2009-07-21 07:22:22
如果其他单元格也包含文本框,则需要找到它们并设置其文本值。
foreach (GridViewRow grdrow in DGPlanilla.Rows)
{
TextBox toDisplay = (TextBox)grdrow.FindControl("TextBox1");
toDisplay.Text = valor;
}
https://stackoverflow.com/questions/1159873
复制相似问题