Within my ASP.NET applications, I incorporate a server-side HTML select control.
<select id="CompanyDropDown" runat="server" style="width:330px">
</select>
To populate and pre-select items in this control, I use a JavaScript function triggered by a link on the page. This implementation successfully displays all items with the correct one selected.
However, during a postback event such as clicking a button,
<asp:Button runat="server" ID="btnSaveCompany" Text="Save"
onclick="btnSaveCompany_Click" />
The CompanyDropDown.Value
becomes empty and loses its list of items. Any recommendations for retaining the selected value after postback?
(Please note that attempting to utilize an ASP.NET DropDown control resulted in postback validation issues when adding items dynamically after rendering the page.)