Reputation: 46322
I have the following in vb.net
<asp:RadioButtonList ID="rbEdit5" runat="server" RepeatDirection="horizontal" >
<asp:ListItem Value="1" >Yes</asp:ListItem>
<asp:ListItem Value="0" >No</asp:ListItem>
</asp:RadioButtonList>
I need to programatically select one of the 2 listitems. How do I programatically select say 'Yes' above in vb.net
Upvotes: 2
Views: 1689
Reputation: 2098
For Each li As ListItem In rbEditTop25.Items
If li.Text= "Yes" Then
li.Selected = True
End If
Next
Upvotes: 0
Reputation: 46067
This should work:
rbEditTop25.Items.FindByText("Yes").Selected = True
Upvotes: 2