I was playing around with the AJAX Control Toolkit CascadingDropDown extender. I set it up to use a webservice method to populate the contents. Everything worked perfectly until I triggered an event that caused a post back. This is when I received the following error:
Basically, it is saying that you either have to turn event validation off for the page or register it with event validation. Well, turning off event validation for the page is not an option in my book. That poses a serious security risk.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.
So I tried registering it with the ClientScriptManager and fed it every possible value for the drop down lists I had on my page. This DID NOT work either.
The solution I found, posted by another person with the same problem, was to override the render method and databind all possible values for the drop down lists.
So, in my code for the page:
Above, DropDownList1 is the TargetControlID of the CascadingDropDown. That was it! Any postback event on my page no longer triggered the error.Code:Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) With Me.DropDownList1 .DataSource = myDataSource .DataTextField = "mydatatextfield" .DataValueField = "mydatavaluefield" .DataBind() End With MyBase.Render(writer) End Sub



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks