ASP.NET Rows 属性

定義と使用法

Rows 属性は、ListBox 内の表示行数(スクロールなし)を取得または設定します。

構文

<asp:ListBox Rows="num" runat="server">
some content
</asp:ListBox>
属性 説明
num ListBox 内の表示行数(スクロールなし)を指定します。

以下の例では、ListBox コントロールの Rows 属性を設定しています:

<form runat="server">
<asp:ListBox id="lb1" Rows="5" runat="server">
  <asp:ListItem Value="Item1" />
  <asp:ListItem Value="Item2" />
  <asp:ListItem Value="Item3" />
  <asp:ListItem Value="Item4" />
  <asp:ListItem Value="Item5" />
</asp:ListBox>
</form>

ListBox コントロールの Rows 属性を設定する