Default Checked value for radiobutton based on data

cthang

Member
Joined
Feb 10, 2009
Messages
8
Programming Experience
Beginner
Hi,

I have a radiobuttonlist and would like to have one of the radio buttons checked based on the grade a sql table. So if a student is in grade 10 then the radio button Grade 10 would be checked .

Here is my radiobuttonlist:

VB.NET:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="355px" 
            AutoPostBack="True" RepeatDirection="Horizontal" Checked=<%# Container.DataItem("grade") %>

            <asp:ListItem Value="09">Grade 9</asp:ListItem>
            <asp:ListItem Value="10" >Grade 10</asp:ListItem>
            <asp:ListItem Value="11">Grade 11</asp:ListItem>
            <asp:ListItem Value="12">Grade 12</asp:ListItem>
        </asp:RadioButtonList>

Thanks
 
Back
Top