ASP.Net/HTML Control/CheckBox

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

Using the HTML Input CheckBox Control: 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 chkDrawing.Checked = True Then
        MyMessage.InnerHTML = "You have entered the " _
            & "drawing.<BR>"
    End If
    If chkContact.Checked = True Then
        MyMessage.InnerHTML = MyMessage.InnerHTML _
            & "You are on our contact " _
            & "list.<BR>"
    End If
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Using the HTMLInputCheckBox Control</TITLE>
</HEAD>
<BODY>
<form runat="server">
<Span
    id="MyMessage"
    runat=server
>
</Span>    
<BR>    
<Input
    id="chkDrawing"
    runat="server"
    type="checkbox"
>
Enter free drawing? 
<BR><BR>
<Input
    id="chkContact"
    runat="server"
    type="checkbox"
    checked
>
Be added to our contact list? 
<BR><BR>
<button 
    id="Button1"
    runat="server"
    onserverclick="SubmitBtn_Click" 
>
Submit
</button>
</Form>
</BODY>
</HTML>