开发者

dropdownlist issue

I have a dropdownlist generated from db. Here is the result from page source.

<select id="testList" name="testList">
<option value="0"></option>
<option value="0">A</option>
<option value="1">B</option>
</select>

Does anyone know 开发者_如何学Gowhy the empty is still zero? How come I dont get something like "" for the first one since it's empty?

<div class="editor-field">
<%= Html.DropDownList("list") %>
</div>

ViewData["list"] = new SelectList(list, "Id", "Value");


Because I suppose that you have used a value type such as Int32 for the Id property. Try using a nullable integer instead: int?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜