我有一个静态下拉列表,包含以下html。
<asp:DropDownList width="100px" ID="dropDownActive" Runat="server">
<asp:ListItem Text="Inactive" Value="0"/>
<asp:ListItem Text="Active" Value="1" />
</asp:DropDownList>
我试图根据数据填充所选值,但在到达该值之前,它的值为0,并且不会接受新值。
dropDownActive.SelectedValue = (support.Active)? "Active": "Inactive";
最佳答案
下拉列表的值为“0”和“1”,而不是“活动”和“非活动”
dropDownActive.SelectedValue = (support.Active)? "1": "0";
关于c# - 静态下拉列表填充不正确的值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6541559/