I am binding a country state city dropdown on an asp.net page using jquery ajax.
All goes well until the page is posted back to the server. The values that user selected for country state and city doesn’t gets available to submit function.
Reason for this seems to be dropdown items getting binded from ajax are not written to viewstate and hence on submit no values is found.
What can be the workaround.
Not only that, with the ViewState validation turned on, you should also get a security exception – since the value the page POSTs with is not at the list of available values.
Web Forms engine is a paranoiac when it comes to request validation.
The usual solution is to:
1) disable event validation for the page
2) do not rely on
SelectedItemof the combo (as the value the browser submits is not on the list) but rather read it from a lower levelthis.Request.Form["dropdownID"].