Invalid postback or callback argument. Event validation
is enabled using <pages enableEventValidation="true"/> in
configuration or <%@ Page EnableEventValidation="true" %> in a
page. For security purposes, this feature verifies that arguments to
postback or callback events originate from the server control that
originally rendered them. If the data is valid and expected, use the
ClientScriptManager.RegisterForEventValidation method in order to
register the postback or callback data for validation.
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.