ASP.NET Rows 屬性


ListBox 控件 ListBox 控件

定義和用法

屬性用於獲取或設置 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 控件 ListBox 控件