I had a huge problem and spend hours trying to make it work, but no luck.
My issue was, I had 2 dropdowns, once the first one is selected, the second is ajax populated. But when I want to capture it using C# codebehind, the selected value won’t reflect.
Is there any proper way by doing this and capturing the second dropdown, using code behind only, without using the isPostBack Request method?
If you check out my new running website, below the navigation, you will see my scenario.
I had to capture it on this page : http://www.mabinx.com/AddYourWebsite
Any help will be appreciated! 🙂
Solution :
If you populate a .Net dropdown with ajax, the codebehind won’t get the dynamically added list items on postback.
All you have to do is to create a .Net hidden input tag (runat server), and bind an onChange event, and populate the .Net hidden field with the selected dropdown selection value.
To reference the selected ajax’ed dropdown list item in the codebehind, just reference the .Net hidden field value.