I am using js function to add items in dropdownlist.All items are added perfectly but when I want to add selected value from that in DB,On clicking button the dropdownlist gets reset on postback.
How can I stop this?
An option would be to add an
onChange event of your dropdown to write the selectedvalue into the hiddenfield input. This value will then be accesible after postback. You still have to re-populate the dropdown again after postback though.
<asp:HiddenField ID="DropDownValue" runat="server" /> <select onChange='document.getElementById("<%= DropDownValue.ClientID %>").value = this.value;'></select>