ASP.NET - WEBフォームコントロール - asp:ListBoxAdvertisement用途
asp:ListBoxコントロールを使用すると、リストボックスを利用することができる。
書式
<asp:ListBox
id="コントロールID"
Rows="表示行数"
SelectionMode="選択モード"
runat="server">
<asp:ListItem Value="値">テキスト</asp:ListItem>
</asp:ListBox>
※上記の属性以外にも、見栄えの定義などの属性があります。Rows 画面に表示する行数。 SelectionMode 選択モードの指定。Singleを指定すると単一選択のみ可能となり、Multipleを指定すると複数行選択することができるようになる。 サンプル
サンプルコード
<form runat="server">
<asp:ListBox id="ListBox01"
Rows="3"
SelectionMode="Multiple"
runat="server">
<asp:ListItem Value="tokyo">東京都</asp:ListItem>
<asp:ListItem Value="kanagawa">神奈川県</asp:ListItem>
<asp:ListItem Value="saitama">埼玉県</asp:ListItem>
<asp:ListItem Value="chiba">千葉県</asp:ListItem>
<asp:ListItem Value="nagano">長野県</asp:ListItem>
</asp:ListBox>
</form>
実行イメージ SelectionMode=Simgle Rows=3 SelectionMode=Multiple Rows=5 イベント
SelectedIndexChanged
Advertisement |
ショートカット・634・634ブログ ・このカテゴリのトップページに戻る ・Incubator(Pukiwiki) ・634ラボ UIコレクションギャラリー ZO-3ジェネレーター サイト検索Y!ログールビリヤード |