ASP.Net/HTML Control/RadioButton — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 11:53, 26 мая 2010

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>