ASP.NET Rows Property

Definition and Usage

The Rows property is used to get or set the number of visible rows in the ListBox (no scrolling).

Syntax

<asp:ListBox Rows="num" runat="server">
some content
</asp:ListBox>
Property Description
num Specify the number of visible rows in the ListBox (no scrolling).

Example

The following example sets the ListBox control's Rows property:

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

Example

Set the ListBox Control's Rows Property