Using the CascadingDropDown control extender that ships with the AJAX Control Toolkit requires that EnableEventValidation property of the Page containing the target DropDownList control be set to false.
However, this can potentially expose our page to a malicious attack, since nothing can then prevent "generated" post-backs.
A more elegant approach is creating a class that derives from DropDownList as follows:
public class NoValidationDropDownList : DropDownList
{ }
After the class has been created, all we need to do is replace the instances of the DropDownList class with respective instances of the NoValidationDropDownList class.
The reason why this works is simple: ASP.NET only validates controls that are marked with the SupportsEventValidation attribute. Since our class is not marked with this attribute, ASP.NET does not validate items on post-back and, consequently, no exception is thrown.
Cheers,
Kirill
Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts
Tuesday, March 24, 2009
Subscribe to:
Posts (Atom)