Is there any way to bind a datasource to an html select tag with runat=server
attribute.
<select runat="server" onchange="showdistrict();" class="textbox" id="DpCity" name="DpCity">
<option value="0">unknow</option>
</select>
I found the answer myself so I'll share it. by using runat="server" attribute and assigning an id to control it will be accessible in code behind. for example DpCity is my html select tag so I can use below code for binding datasource:
DpCity.DataTextField = "title";
DpCity.DataValueField = "val";
DpCity.DataSource = SrCity;
DpCity.DataBind();
as like as an asp dropdown list box
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With