I have a dropdownlist in my asp.net page
<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>
On Page load, the selectedvalue is set based on the value that comes from database.
rdblstcookinglevel.SelectedValue = user.CookingLevel;
But when on the page user changes selection, the selectedindex does not change, so the old selected value is sent back to database.
User.CookingLevel = rdblstcookinglevel.SelectedValue;
Make sure the setting of the
SelectedValueis only done on the first load of the page – and not done on the post back, i.e…