gyz, What is the actual solution for this error. For now i made enableEventValidation="false" then the error has went, But i am not satisfied. Please suggest me where and what i am doing wrong. Now i have one more issue. my dropdown list is not getting
validated. Please let me know.
as far as i am aware it is because the control calling the onclick/change event for the control is actually different from the control the created the event, but has the same id. i got that when i had a datagrid with a button. the button onclick triggered
AFTER the page load, which is where i generated my grid. so what happened a button gets clicked on, then it posts back, recreate that same button (in my grid) on page load and then procress the onclick for that button...at which time the button is now a whole
new button...not the same button...so it sees it as a control trying to execute the event for another control.
check in your page_load, if you create controls there dynamically, then only do it if (!Page.IsPostback())...that should help.
that is as much as i ever dealt with this issue, hope it helps.
I also faced same type of problem. But i found a solution for my application. This might help for someone else also.
I was using GridView and had some button controls within that. And so on the click of the button i was receiving same type of problem. What I did is I set the "EnableViewState" property of the GridView to "False" i.e., disable the view state of the gridview.
That really solved my problem. Now I was not receiving such type of error and even the event was properly posting back.
the issue may raise if you execute the DataBind() Method for the repeater on the PageLoad event because it will re-assign new control IDs before reaching the ItemCommand event for the repeater control. you should call DataBind() with a conditional if (!IsPostBack),
the issue may raise if you execute the DataBind() Method for the repeater on the PageLoad event because it will re-assign new control IDs before reaching the ItemCommand event for the repeater control. you should call DataBind() with a conditional if (!IsPostBack),
me.sachan
Member
212 Points
65 Posts
Re: error: enableEventValidation="true"/
Jun 26, 2009 12:14 PM|LINK
gyz, What is the actual solution for this error. For now i made enableEventValidation="false" then the error has went, But i am not satisfied. Please suggest me where and what i am doing wrong. Now i have one more issue. my dropdown list is not getting validated. Please let me know.
<center> <br /> <yo:errorMssg ID="error" runat="server" Visible="false" /> <yo:infoMssg ID="info" runat="server" Visible="false" /> <br /> <table width="85%" border="0"> <tr> <td> Label </td> <td> : </td> <td> <asp:DropDownList ID="ddlLabels" runat="server" /> </td> </tr> <tr> <td> </td> <td> </td> <td> <asp:RequiredFieldValidator ID="rfvLabel" InitialValue="-1" ErrorMessage="Label" runat="server" SetFocusOnError="true" Display="Dynamic" ControlToValidate="ddlLabels">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> Artist </td> <td> : </td> <td> <asp:DropDownList ID="ddArtists" runat="server" /> </td> </tr> </table> </center> <br /> <ajaxToolkit:CascadingDropDown ID="cscddlLabel" runat="server" TargetControlID="ddlLabels" Category="LabelName" PromptText="-- Select Label --" EmptyText="No Label Found!" PromptValue="-1" LoadingText="Loading . . ." ServicePath="~/WebServices/DanMusicService.asmx" ServiceMethod="GetLabels" /> <ajaxToolkit:CascadingDropDown ID="cscddlArtist" runat="server" PromptValue="-1" TargetControlID="ddArtists" ParentControlID="ddlLabels" PromptText="-- Select Artist --" EmptyText="No Artist Found!" LoadingText="Loading . . ." ServiceMethod="GetArtists" ServicePath="~/WebServices/DanMusicService.asmx" Category="Name" /> <asp:LinkButton ID="lnkSubmit" runat="server" Text="Save"></asp:LinkButton>As.NET CascadingDropDown CascadingDropDown validation
Sandeep Sachan
Sandeep Sachan Blog
www.sandeepsachan.com
Please remember to click “Mark as Answer” on the post that helps you.
krappies
Member
200 Points
52 Posts
Re: error: enableEventValidation="true"/
Jun 26, 2009 01:12 PM|LINK
hi
as far as i am aware it is because the control calling the onclick/change event for the control is actually different from the control the created the event, but has the same id. i got that when i had a datagrid with a button. the button onclick triggered AFTER the page load, which is where i generated my grid. so what happened a button gets clicked on, then it posts back, recreate that same button (in my grid) on page load and then procress the onclick for that button...at which time the button is now a whole new button...not the same button...so it sees it as a control trying to execute the event for another control.
check in your page_load, if you create controls there dynamically, then only do it if (!Page.IsPostback())...that should help.
that is as much as i ever dealt with this issue, hope it helps.
ghtmatrix
Member
2 Points
1 Post
Re: error: enableEventValidation="true"/
Aug 06, 2009 02:47 PM|LINK
U save me brother!!!!
thanks a lot!
bartekm
Member
240 Points
106 Posts
Re: error: enableEventValidation="true"/
Dec 15, 2009 07:49 AM|LINK
There is a good article on EventValidation at
Invalid postback or callback argument with EnableEventValidation="true"
http://blog.evonet.com.au
Knudde
Member
2 Points
2 Posts
Re: error: enableEventValidation="true"/
Jun 03, 2010 10:02 AM|LINK
I can confirm this.
Moved my code that did the gridview databinding into the " if not page.postback then" condition
so that it would not run on a postback and bingo, issue solved
tnxs a lot for this valuable insight
Kriz
vinod83k
Member
2 Points
1 Post
Re: error: enableEventValidation="true"/
Aug 08, 2010 12:12 PM|LINK
I also faced same type of problem. But i found a solution for my application. This might help for someone else also.
I was using GridView and had some button controls within that. And so on the click of the button i was receiving same type of problem. What I did is I set the "EnableViewState" property of the GridView to "False" i.e., disable the view state of the gridview. That really solved my problem. Now I was not receiving such type of error and even the event was properly posting back.
Thanks,
Vinod
rory somy
Member
12 Points
7 Posts
Re: error: enableEventValidation="true"/
Mar 15, 2011 10:23 AM|LINK
the issue may raise if you execute the DataBind() Method for the repeater on the PageLoad event because it will re-assign new control IDs before reaching the ItemCommand event for the repeater control. you should call DataBind() with a conditional if (!IsPostBack),
rory somy
Member
12 Points
7 Posts
Re: error: enableEventValidation="true"/
Mar 15, 2011 10:23 AM|LINK
the issue may raise if you execute the DataBind() Method for the repeater on the PageLoad event because it will re-assign new control IDs before reaching the ItemCommand event for the repeater control. you should call DataBind() with a conditional if (!IsPostBack),
master of th...
Member
30 Points
33 Posts
Re: error: enableEventValidation="true"/
Mar 27, 2011 07:31 AM|LINK
I think I found another way to eliminate the Error, add this to your Button which triggers the Postback Event:
<div style="font-family: 'Courier New'; font-size: 10pt; color: black; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px;">PostBackUrl=”~/yoursite.aspx”
Just post it back to the same site explicitly and you should be fine.
Hope this helps :)
</div>