using html select tag in Asp.net
When I use following Html Tag in my Asp.net source code I encounter this error message:
<select runat="server" onchange="showcity();" class="textbox" id="DpCity" name="DpCity">
<option value="0" selected="selected">unknown</option>
</select>
Error message in runtime:
DataBinding: 'System.Web.UI.HtmlControls.HtmlSelect' does开发者_如何学Go not contain a property with the name 'SelectedValue'.
what's wrong?
SelectedValue is not a property of a Select control. Select is different than DropDownList. To get the selected value of the Select list, use this code:
var selectedValue = DpCity.Value;
精彩评论