Wednesday, June 19, 2013

RadioButtonList bind inside GridView

  <asp:RadioButtonList ID="rblSentTo" runat="server"  
SelectedValue='<%#Bind("SentTo"%>'>
                                <Items>
       <asp:ListItem Text="Community Members" Value="C"></asp:ListItem>
       <asp:ListItem Text="Parents/Students" Value="P"></asp:ListItem>
       <asp:ListItem Text="" Value=""></asp:ListItem> 
                                </Items>
                            </asp:RadioButtonList>
Here the SentTo is nullable , in case your field is not , you do not need the 3rd ListItem with "" value but if it's nullable, you must add it, otherwise it cant find a match to null value and give an error

No comments:

Post a Comment