<%@ Page Language="VB" %>
<script runat="server">
Sub Submit (obj as object, e as EventArgs)
Dim strIncome as string =country.SelectedItem.Text
Dim strAge as string=r1Age.SelectedItem.Text
lblmessage. Text = "Hi " & tbName. Text & "! <p>" & _
"Your Country is: " & strIncome & "<br>" & _
"Your age is: " & strage & "<br>"
If r1Age. SelectedIndex<3 then
lblmessage. Text + = "You’re a young one! <p>"
Else
lblmessage. Text + = "You’re a wise one! <p>"
End if
If cbname. Checked then
lblmessage. Text + = "We will keep your name confidentially."
End if
End sub
</script>
<Html>
<Body>
<h2>Web server Control Example</h2><hr>
<form runat="server">
<b>
<asp:Label id="lblHeader" runat="server" />
<Br>
<asp:Label id="lblmessage" runat="server" /> <p>
Enter Your Name:
<asp:TextBox id="tbname" runat="server" /> <p>
Choose your age: <br>
<asp:RadioButtonList id="r1age" runat="server" Repeat Direction="horizontal">
<asp:ListItem> <18</asp:ListItem>
<asp:ListItem> <19-24</asp:ListItem>
<asp:ListItem> <25-34</asp:ListItem>
<asp:ListItem> <35-49</asp:ListItem>
<asp:ListItem> <50-65</asp:ListItem>
</asp: RadioButtonList> <p>
Choose your Country: <br>
<asp:ListBox id="country" runat="server" size=2>
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem> CANADA</asp:ListItem>
<asp:ListItem> INDIA</asp:ListItem>
<asp:ListItem> AUSTRALIA</asp:ListItem>
</asp: ListBox> <p>
<p>
Do you want to keep your name confidential? <Br>
<asp:CheckBox id= "cbname" runat="server" text="Yes!" /> <p>
<asp:button id="btSubmit" Onclick="Submit" text="Submit" runat="server" />
</form>
</body>
</html> |