Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Gridview drop-down , +
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 17-Jul-12 2:11am
snamyna1.3K

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Put your dropdown inside trigger of your update panel:
Try below code:
 
 <asp:updatepanel>
            <triggers>
                <asp:asyncpostbacktrigger controlid="YourDropdown" eventname="SelectedIndexChanged" />
            </triggers>
        </asp:updatepanel>
  Permalink  
v2
Comments
snamyna at 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?
Girish .Markunda at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,580
1 OriginalGriff 8,370
2 Peter Leow 4,859
3 Kornfeld Eliyahu Peter 3,210
4 Maciej Los 2,301


Advertise | Privacy | Mobile
Web04 | 2.8.150327.1 | Last Updated 17 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100