开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜