forum

home / developersection / forums / setting radiobuttonlist selected value

Setting RadioButtonList selected value

Anonymous User 1997 15-Jan-2015

I am trying to select the radiobuttonlist's using the following code but it never get selected.

<asp:RadioButtonList ID="rdBond" CssClass="RadioButtonList"
                            runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem>Yes</asp:ListItem>
                            <asp:ListItem>No</asp:ListItem>
                        </asp:RadioButtonList>

and I tried both of the follwing methods but doesn't work.

       ListItem l2 = rdOffset.Items.FindByValue(cd.BondReq.ToString());
        if (l2 != null)
            l2.Selected = true; 
        rdOffset.SelectedValue = cd.Offset.ToString();

Please help to fix it.


Updated on 15-Jan-2015

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By