Page 165 - DCAP312_WEB_TECHNOLOGIES_II
P. 165
Unit 8: Creating More Advanced ASP.NET
<asp:RadioButtonList id= “radiolist1” runat= “server”> Notes
<asp:ListItem selected= “true”>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button text= “Submit” OnClick= “submit” runat= “server”/>
<p><asp:Label id= “Label1” runat= “server”/></p>
</form>
</body>
</html>
8.3.2 CheckBoxList
The CheckBoxList control is used to create a multi-selection check box group.
Each selectable item in a CheckBoxList control is defined by a ListItem element!
<script runat= “server”>
Sub Check(sender As Object, e As EventArgs)
dim i
mess.Text= “<p>Selected Item(s) :</p>“
for i=0 to check1.Items.Count-1
if check1.Items(i).Selected then
mess.Text+=check1.Items(i).Text + “<br/>“
end if
next
End Sub
</script>
<!DOCTYPE html>
<html>
<body>
<form runat= “server”>
<asp:CheckBoxList id= “check1” AutoPostBack= “True”
TextAlign= “Right” OnSelectedIndexChanged= “Check”
runat= “server”>
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
<asp:ListItem>Item 4</asp:ListItem>
<asp:ListItem>Item 5</asp:ListItem>
<asp:ListItem>Item 6</asp:ListItem>
</asp:CheckBoxList>
LOVELY PROFESSIONAL UNIVERSITY 159