الجمعة، 27 ديسمبر 2013

Grid view row command showing error

I am getting this error:

Invalid postback or callback argument. Event validation is enabled using 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.

This is my code:

protected void GridViewCommandEventHandler(object sender, GridViewCommandEventArgs e){ if (e.CommandName == "view") { int row_id = Convert.ToInt32(e.CommandArgument); var result = (from test in je.jobposting where test.id==row_id select test).FirstOrDefault(); Session["id"] = result; } else { int row_id = Convert.ToInt32(e.CommandArgument); var result = (from test in je.jobposting where test.id==row_id select test).FirstOrDefault(); je.DeleteObject(result); je.SaveChanges(); Response.Redirect (""); }}

View the original article here

ليست هناك تعليقات:

إرسال تعليق