I have two dropdownlists inside an ASP.Net AJAX Update Panel. One dropdownlist populates the second through a postback when a user selects a value from the first, and this all works well. However, the problem I have is that I am unable to grab the selectedvalue from the second dropdownlist, by this I mean it always selects the first item rather than the actual selected value.
I have looked at moving the populating the second dropdownlist to If Not IsPostBack Then on the page load, but this then stops the populating of that dropdownlist when the AJAX Update Panel does a partial postback.
So, there is away out of this?
Thanks
If you are changing the value of the second dropdown based on the value selected on the first, you should use the SelectedIndexChanged event of the first dropdown to set the value.
Your code (from comments):
On Page_Load I have the following
On page load the ddlSite.SelectedValue is always zero.
You need to bind the second drop down in the ddlSite_SelectedIndexChanged event.
Page Lifecycle question answered