1
我有一个ASP.NET的页面,在这里我有一个名为拉贝ROWID查找控制返回Null异常
protected void testResultsGridView_onRowUpdating(object sender, GridViewUpdateEventArgs e)
{
string str = string.Empty;
GridViewRow row = testResultsGridView.Rows[e.RowIndex];
Int32 id = Int32.Parse(((Label)row.FindControl("rowId")).Text);
String Cause = ((DropDownList)row.FindControl("Cause")).SelectedValue;
String comment = ((TextBox)row.FindControl("comment")).Text;
String check = ((TextBox)row.FindControl("check")).Text;
String reRunStatus = ((DropDownList)row.FindControl("Status")).SelectedValue;
String subCategory = ((DropDownList)row.FindControl("Category")).SelectedValue;
foreach (GridViewRow gvrow in testResultsGridView.Rows)
{
CheckBox chk = (CheckBox)gvrow.FindControl("cbSelect");
if (chk != null && chk.Checked)
{
id = Int32.Parse(((Label)gvrow.FindControl("rowId")).Text); ;
UpdateTestCase(id, rootCause, subCategory, comment, RTC, reRunStatus);
}
}
testResultsGridView.EditIndex = -1;
BindData();
}
在这种情况下,先找到ROWID返回值和第二个控制内选择scheckbox返回null。我甚至没有动态添加任何控件。可能是什么原因?
我都做到了。事实证明这确实是一个数据行 –
你是否从FindControl中为rowId得到null,那么找到其他控件又该如何呢? – Adil
我无法从gvrow获得任何控制 –