I am getting the error when i press "tick ImageButton.Here it is:-
My code for the RowUpdating is:-
protected void dgvDivision_RowUpdating(object sender, GridViewUpdateEventArgs e) { int DivId = Convert.ToInt32(dgvDivision.DataKeys[e.RowIndex].Value.ToString()); string DivName = ((TextBox)dgvDivision.Rows[e.RowIndex].FindControl("txtDivisionName")).Text; decimal ClassId = decimal.Parse(((TextBox)dgvDivision.Rows[e.RowIndex].FindControl("txtClassName")).Text); if (sqlCon.State == ConnectionState.Closed) { sqlCon.Open(); } SqlCommand sqlCmd = new SqlCommand("", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@divisionId", DivId); sqlCmd.Parameters.AddWithValue("@divisionName", DivName); sqlCmd.Parameters.AddWithValue("@classId", ClassId); int Incount = sqlCmd.ExecuteNonQuery(); if (Incount > 0) { HttpContext.Current.Response.Write("<script>alert('Updated Successfuly');</script>"); } dgvDivision.EditIndex = -1; gridFill(); }
please Help me in this topic.