HTML Input Radio Button: get selected item (VB.net) : RadioButton « HTML Control « ASP.Net






HTML Input Radio Button: get selected item (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

End Sub
Sub SubmitBtn_Click(Source As Object, E as EventArgs)
    MyMessage.InnerHTML = ""
    If radBreakfast.Checked = True Then
        MyMessage.InnerHTML = "You selected " _
            & "breakfast.<BR>"
    ElseIf radLunch.Checked = True Then
        MyMessage.InnerHTML = "You selected " _
            & "lunch.<BR>"
    Else
        MyMessage.InnerHTML = "You selected " _
            & "dinner.<BR>"
    End If
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Allowing Input through the HTMLInputRadioButton Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<Span
    id="MyMessage"
    runat=server
>
</Span>    
<BR>
Which is your favorite meal?  
<BR>
<Input
    id="radBreakfast"
    runat="server"
    type="radio"
    Checked
    name="Meal"
/>
Breakfast 
<BR>
<Input
    id="radLunch"
    runat="server"
    type="radio"
    name="Meal"
/>
Lunch
<BR>
<Input
    id="radDinner"
    runat="server"
    type="radio"
    name="Meal"
/>
Dinner
<BR>
<button 
    id="Button1"
    runat="server"
    onserverclick="SubmitBtn_Click" 
>
Submit
</button>
</Form>
</BODY>
</HTML>
           
       








Related examples in the same category