Skip to content Skip to sidebar Skip to footer

Populating Dropdownlist Client Side. Getting Post Back Validation Error

I have a webcontrol with two dropdownlists on in. When you choose something from the first, the second is populated accordingly. When post back occurs I get the old: Invalid post

Solution 1:

You might have to use a basic html select and look for the selected value on the Request.Form collection.

With the DropdownList I'm afraid you have no other option but those 2.

Solution 2:

Unfortunately, there is no support for disabling event validation on a per-control basis. In my experience, though, disabling event validation on a page is not all that bad.

Regardless of whether event validation is enabled, wise developers validate all input. Tools like the AntiXSS library can come in handy for identifying and/or sanitizing potentially malicious input.

If you are already following practices where you carefully validate form input, then disabling the out-of-the-box ASP.NET validation behavior should be a viable solution that doesn't add substantial risk to your project.

Solution 3:

Render method may solve your issue. But, faster is subclassing. Do nothing, but subclass your DropDownList and use that in your aspx page.

I did it, and worked.

Post a Comment for "Populating Dropdownlist Client Side. Getting Post Back Validation Error"