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 屬性