Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dropdownlist and gridview inside an update panel whereby the data in gridview will change according to dropdownlist selectedindexchanged.
However, I just receive this kind of error which i never get before.
what does it mean and how can I solve this?

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: 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.
Posted

1 solution

Put your dropdown inside trigger of your update panel:
Try below code:

ASP.NET
<asp:updatepanel>
           <triggers>
               <asp:asyncpostbacktrigger controlid="YourDropdown" eventname="SelectedIndexChanged" />
           </triggers>
       </asp:updatepanel>
 
Share this answer
 
v2
Comments
snamyna 17-Jul-12 22:29pm    
Somehow other labels and textboxes also get the same effect as the same error popup. I have googled n found some solution where they ask to put EnableEventValidation="false" on my page.
How this solution will effect my website?
teacher686 30-Oct-12 5:44am    
sir,i wanted to change the content of gridview as per the selection that i am making in my DropDownlist and that selected value i wanted to pass my stored procedure as input parameter and i wanted to pass without using button

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string ConnectionString = ConfigurationManager.ConnectionStrings["GirishTestConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(ConnectionString);
var @class = DropDownList2.SelectedValue;
string st = @class;
con.Open();
// SqlDataReader rd;
SqlCommand cmd = new SqlCommand("DBTest2_sp", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@class", DropDownList2.SelectedValue);
SqlDataAdapter sqlda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sqlda.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();



}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900