ASP.Net/HTML Control/RadioButton

Материал из .Net Framework эксперт
Версия от 11:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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>