When developing a web page, we sometimes use the htmlselect control as the selection control for the list item, and sometimes modify its value (such as Ajax) using JS on the client ), however, the modified value cannot be accessed in the CS code of the server, because the modified form value of JS is not synchronously updated to ASP. net viewstate to hide the domain. The solution is as follows:
1. If you only access the selected value of the htmlselect control, you can use request. Form ["select1"]. tostring () to obtain
2. if you want to access the value and text values at the same time, you can add a hidden field in the form <asp: hiddenfield>, and synchronously update the value of this hidden field when the foreground JS updates the htmlselect control, then, the backend CS can obtain the value of the hidden domain.
Think about the MS bug. The value updated by JS in <asp: hiddenfield> can be accessed in the background, <select runat = "server"> the updated value of the control cannot be accessed by CS in the background.