我有一个dropdownlist
在我的asp.net页面下拉列表的selectedIndex不节能
<asp:RadioButtonList ID="rdblstcookinglevel" runat="server" CellPadding="0"
CellSpacing="0" >
<asp:ListItem>Novice</asp:ListItem>
<asp:ListItem>Beginner</asp:ListItem>
<asp:ListItem>Intermediate</asp:ListItem>
<asp:ListItem>Expert</asp:ListItem>
<asp:ListItem>Professional</asp:ListItem>
</asp:RadioButtonList>
在页面加载时,selectedvalue
是基于来自数据库中的值设置。
rdblstcookinglevel.SelectedValue = user.CookingLevel;
但是,当页面用户改变选择,selectedindex
不会改变,所以老选定值发送回数据库。
User.CookingLevel = rdblstcookinglevel.SelectedValue;
谢谢这么多,它解决了我的问题:) – 2012-07-24 10:59:24