Hi, In page directive simply write: EnableEventValidation="false"
The page should work fine. On Wed, Oct 6, 2010 at 1:17 AM, Barun <[email protected]> wrote: > Hi. > > I am having a big problem solving this error: > *"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."* > > Scenario: > > I have a gridView which will be loaded with data when the page loads for > the first time. In the same page i have one search user control outside of > GridView which have dropdown and a submit button. User select from dropdown > and click submit button to pass dropdown selected index. The page reloads > and bind the Grid again with new information related with search. > My GridView also have one user control inside gridview ItemTemplate which > have labels, textboxex, checkboxes created dynamically. Such that when each > row of GridView is clicked, it opens up with data related to that row and > dynamically binds controls with information. > Now, When i do search GridView filters out the information and show data > correctly, which is fine till here, but once i click on each row to see its > inner part it display the above error. > When no search is performed, everything works fine. > I am guessing when Search is performed, the grid is rebind again to new > datasource on page load and hence changes all controls IDs. Since postback > is performed and server is not getting correct control indentification, the > server is throwing that error. > > Any help would be apprciated alot. > > protected void Page_Load(object sender, EventArgs e) > { > > if (!IsPostBack) > { > DataTable mDT = Utility.BuildDataTable("SELECT * FROM TABLE"); > GridView1.DataSource = mDT; > GridView1.DataBind(); > } > > > // Search results > > int ddltypeID = ddl.SelectedValue; > String strSql = ""; > String strAnd = ""; > > > if (ddltypeID != -1) > { > strSql = strSql + strAnd + "Measure_Type = " + UCTypeID; > > DataTable dt = msadapter.GetData(); > DataRow[] dr = dt.Select(strSql); > > GridView1.DataSource = dr; > GridView1.DataBind(); > > } > > } > > > -- Prabhjot Singh http://codingdigest.blogspot.com
