Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select a radio button by default in asp.net

Tags:

c#

asp.net

I have a radio button and I would like to default the first item as checked by default. How do I go about doing that? Below is my source code for the radio button.

<asp:RadioButtonList ID="radRiskLevel" runat="server" RepeatDirection="Horizontal">
     <asp:ListItem Value="High">High</asp:ListItem>
     <asp:ListItem Value="Mid">Mid</asp:ListItem>
     <asp:ListItem Value="Low">Low</asp:ListItem>
</asp:RadioButtonList>
like image 439
geraldinetsy Avatar asked Nov 30 '22 17:11

geraldinetsy


1 Answers

ASPX Markup

<asp:RadioButtonList ID="radRiskLevel" runat="server" RepeatDirection="Horizontal">
     <asp:ListItem Value="High" Selected="True">Select</asp:ListItem>
     <asp:ListItem Value="High">High</asp:ListItem>
     <asp:ListItem Value="Mid">Mid</asp:ListItem>
     <asp:ListItem Value="Low">Low</asp:ListItem>
</asp:RadioButtonList>                                                                       
like image 156
Kaushik Maheta Avatar answered Dec 05 '22 07:12

Kaushik Maheta