0

dbからの名前gettinデータを表示するチェックボックスリストがdivにあります。選択したアイテム/値に対してdbアクションを実行するには、OnSelectedIndexChangedでこのチェックボックスリストの長さを確認する必要があります。誰かが私を助けてくれます!!!!!

4

2 に答える 2

0
<asp:CheckBoxList id="Check1" RepeatLayout="flow" runat="server" AutoPostBack="true" >
 <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>

Protected Sub Check1_SelectedIndexChanged (ByVal sender As Object, ByVal e As System.EventArgs) Check1.SelectedIndexChanged を処理します

Dim items As String = Check1.Items.Count

サブ終了

于 2010-08-18T07:29:40.937 に答える
0

CheckBoxList変数が呼び出されたと仮定してcheckboxlist、次を使用してアイテムの量を決定します。

int numberOfItems = checkboxlist.Items.Count

このCheckBoxList.Itemsプロパティは、コントロールを含む を返しますListItemCollection。ここから count プロパティを使用して、リストの長さまたは含まれる項目の数を決定できます。

于 2010-08-18T07:25:10.420 に答える