【发布时间】:2010-01-11 09:20:25
【问题描述】:
我有一个 List(Of SelectListItem),我用 NativeName 作为 .Text 和两个字母的 ISO 区域名称作为 .Value 填充它。
Dim countryList As IList(Of System.Globalization.RegionInfo) = GetRegionInfosForEuOnly() 将 dropDownCountryList 调暗为新列表(Of SelectListItem)
For i As Integer = 0 To countryList.Count - 1
dropDownCountryList.Add(New SelectListItem() With {.Text = countryList(i).NativeName, .Value = countryList(i).TwoLetterISORegionName})
Next
...
<td>
<%=Html.DropDownList(customerType & "CountryCode", dropDownCountryList)%>*
<%=Html.ValidationMessage(customerType & "CountryCode")%>
</td>
现在我想将德国的 RegionInfo 设置为 DropDownList 中的预选项目。 但是
dropDownCountryList.Item(4).Selected = True
不起作用。
有什么想法吗?
【问题讨论】:
标签: asp.net-mvc drop-down-menu