Contolling #of rows in a Web Listbox Control

H

Hugh O

Hi,
There is a ROW property on the Web Listbox control within VB.Net. The
description states it is "The number of visible rows to display".

I have tried setting this property in many different ways. It does not
appear to do much of anything. I was trying to use it to control the
actual size in rows of the list box on the Web page. But the size of the
Web listbox seems to be fixed and controlled by the size of the control set
in the designer. If there are more than the rows possible within that
control size, a scroll bar, permits an unlimited number of rows.

The setting of the Listbox.Row property does not appear to make any
differences good or bad. Can you control the size of the listbox using this
property? If so, what is a valid format for the setting? Just setting a
number does not appear to do anything.

thanks,
hugh
 
S

Steven Cheng[MSFT]

Hi Hugh,

Welcome to MSDN newsgroup.
As for the ROW property, do you mean the "Rows" property of the ASP.NET
ListBox webserver control? This property is used to control how many rows
will be visible in the ListBox (when there're many items) and the Rows
propety is actually render as "size" attribute in clientside html like
below:

ASPX: <asp:ListBox id="ListBox1" Rows="3" runat="server">
||
V
HTML: <select name="ListBox1" size="3" id="ListBox1">

Also, to make sure the "Rows" property work as expected, we need to prevent
the ListBox being applied other size css attributes like:

<asp:listbox id="ListBox1" runat="server" Rows="3" Width="72px"
Height="72px">

in such condition, the Rows setting will be override by the "Height"
attribute which is rendered as:

<select name="ListBox1" size="3" id="ListBox1"
style="height:72px;width:72px;">

If you have anything else unclear, please feel free to post here. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "Hugh O" <[email protected]>
| Subject: Contolling #of rows in a Web Listbox Control
| Date: Tue, 13 Sep 2005 16:32:00 -0400
| Lines: 20
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: pcp01784214pcs.audubn01.nj.comcast.net 68.46.176.167
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.vb:105552
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hi,
| There is a ROW property on the Web Listbox control within VB.Net. The
| description states it is "The number of visible rows to display".
|
| I have tried setting this property in many different ways. It does not
| appear to do much of anything. I was trying to use it to control the
| actual size in rows of the list box on the Web page. But the size of the
| Web listbox seems to be fixed and controlled by the size of the control
set
| in the designer. If there are more than the rows possible within that
| control size, a scroll bar, permits an unlimited number of rows.
|
| The setting of the Listbox.Row property does not appear to make any
| differences good or bad. Can you control the size of the listbox using
this
| property? If so, what is a valid format for the setting? Just setting a
| number does not appear to do anything.
|
| thanks,
| hugh
|
|
|
 
H

Hugh O

Steven,
Thanks a lot. I would have NEVER on my own figured out that the ASP.Net
Listbox.Rows property fails to work when you do not accept the default shape
in the designer phase. The Rows property is not adequately documented in
the Help facilities and it makes no mention of the impact of using other
size attributes. I have now learned that in the designer phase you can
make the Listbox wider but you can not drag the listbox longer or in any way
set the Height property.

Thanks again.
hugh
 
S

Steven Cheng[MSFT]

Thanks for your followup.

En yes, sometimes the design-time added position/size attributes dosn't
seem quite well. That's why it's removed in the VS.NET2005 since for
webpage, the flowlayout is the most natural one which is accepted by most
web developers.

Thanks again for your posting.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Hugh O" <[email protected]>
| References: <#[email protected]>
<[email protected]>
| Subject: Re: Contolling #of rows in a Web Listbox Control
| Date: Wed, 14 Sep 2005 13:14:13 -0400
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uAQw8#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: pcp01784214pcs.audubn01.nj.comcast.net 68.46.176.167
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.vb:105704
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Steven,
| Thanks a lot. I would have NEVER on my own figured out that the ASP.Net
| Listbox.Rows property fails to work when you do not accept the default
shape
| in the designer phase. The Rows property is not adequately documented in
| the Help facilities and it makes no mention of the impact of using other
| size attributes. I have now learned that in the designer phase you can
| make the Listbox wider but you can not drag the listbox longer or in any
way
| set the Height property.
|
| Thanks again.
| hugh
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top