protected void schgrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//getting username from particular row
string schlName = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "schlName"));
//identifying the control in gridview
ImageButton lnkbtnresult = (ImageButton)e.Row.FindControl("imgbtnDelete");
//raising javascript confirmationbox whenver user clicks on link button
lnkbtnresult.Attributes.Add("onclick", "javascript:return ConfirmationBox('" + schlName + "')");
}
}
这是上面一行的错误:
你调用的对象是空的
protected void schgrid_RowEditing(object sender, GridViewEditEventArgs e)
{
schgrid.EditIndex = e.NewEditIndex;
if (txtSearch.Text == "")
{
BindSchoolDetails();
}
else
{
BindSearchDetails();
}
}
每当我使用rowEditing
时,都会引发异常,schgrid_RowDataBound
其中实际用于删除 gridview 记录。
请帮我解决这个问题。给我看一些代码来纠正这个问题