ASP.NET HTML 控件 CheckboxList

asp.net html 控件  checkboxlist

<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>
<br>
<asp:label id="mess" runat="server"/>
</form>

</body>
</html>
相关文章