我注意到当我从gridview中的选定行填充文本框时,如果该字段为空,则在文本框中显示" ".
这是我提出的解决方案.我在检查每个单元格之前将其添加到文本框中.
我觉得我要么做错了,要么首先出现这个问题,要么就是有更好的方法来解决这个问题.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
//// Get the currently selected row using the SelectedRow property.
GridViewRow row = GridView1.SelectedRow;
// Load data from selected row into textboxes
if (row.Cells[1].Text.Trim() != " ")
{
txtEditCust_ID.Text = row.Cells[1].Text.Trim();
}
}
Run Code Online (Sandbox Code Playgroud)