<%=Html.RadioButton("BookType", "1") %> C# <%=Html.RadioButton("BookType", "2") %> VB
Above code generates Below code
<input id="BookType" name="BookType" type="radio" value="1" >C# <input id="BookType" name="BookType" type="radio" value="2" >VB
I need same name but different ids
I want output like
*
<input id="rdoCSharp" name="BookType" type="radio" value="1" >C# <input id="rdoVb" name="BookType" type="radio" value="2" >VB
*
The radio button to be selected is located by two arguments: group_name is used as the name of the radio input, value is used for the value attribute or for the id attribute.
ASP.NET Web Forms RadioButton. It is an input control which is used to takes input from the user. It allows user to select a choice from the group of choices. To create RadioButton we can drag it from the toolbox of visual studio.
You can override the defaults by passing the attributes you wish to apply using an overload of the RadioButton method:
<%=Html.RadioButton("BookType", "1", new { id = "yourId" }) %> C#
<%= Html.RadioButton("BookType", "1", new { id = "rdoCSharp" }) %> C# <%= Html.RadioButton("BookType", "2", new { id = "rdoVb" }) %> VB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With