I'm trying to make a grid view which allow user to key in data on the column, once they click the edit button inside grid view. But now when i debug, once i click edit button , the system kept run on the GridView1_RowDataBound() function after finish run the edit command function.
CODE
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Admin admin = new Admin();
admin.AdminID = Convert.ToInt32((string)Session["adminID"]);
admin.AdminName = (string)Session["username"];
Button btn = e.Row.FindControl("btnEdit") as Button;
if (e.Row.RowType == DataControlRowType.DataRow)
{
btn.Attributes.Add("onClick", "return confirm('Are you sure you wish to edit this item?');");
TextBox txtBox1 = (TextBox)e.Row.FindControl("txtlinkdetail");
txtBox1.Enabled = false;
}
CODE
protected void GridView1_RowEditing(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName == "Edit")
{
// GridView1.EditIndex = e.NewEditIndex;
GridViewRow row = GridView1.Rows[Convert.ToInt32(e.CommandArgument)];
GridView1.DataBind();
}
}
Then it return an error as below:

Can tell me how to solve the problem? Thx