[英]New value on gridview edit mode
How to get the new value of boundcolumn(default textbox on edit mode) when the gridview is in edit mode on external button click. 在外部按钮单击时,GridView处于编辑模式时,如何获取boundcolumn的新值(编辑模式下为默认文本框)。
if (grdMappingLog.HeaderRow != null)
{
for (int i = 0; i < grdMappingLog.HeaderRow.Cells.Count; i++)
{
dt.Columns.Add(grdMappingLog.HeaderRow.Cells[i].Text);
}
}
foreach (GridViewRow row in grdMappingLog.Rows)
{
DataRow dr;
dr = dt.NewRow();
for (int i = 0; i < row.Cells.Count; i++)
{
dr[i] = row.Cells[i].Text.Replace(" ", "");
}
dt.Rows.Add(dr);
}
Try this: 尝试这个:
TextBox txt= (TextBox)GridView1.Rows[GridView1.EditIndex].Cells[2].Controls[0];
Response.Write(txt.Text);
Cells[2] retrive TextBox in column 2 of gridview1 Cells [2]检索gridview1的第2列中的TextBox
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.