user8675725
user8675725

Reputation:

ASP.NET Listbox Height

So I have a <div> and inside that i have a <p> with <asp:ListBox> and I am trying to make this list box so that it can display at least 10 items at a time. I have tried Rows="10" or Size="10" and also `Height"100%".

It might be worthing adding that it is in a popup rather than a page itself (the size may be restricted to the size of the popup window maybe) but you can see this in the following code:

<div  class="left_panel my">
    <div class="form_fieldTxtarea_Dv">
        <label>Hospital<span class="man">*</span></label>
        <p>
            <asp:ListBox 
                ID="lstHospital" 
                runat="server" 
                Height="100%" 
                ToolTip="Select Hospital" 
                class="form-control 
                textAreah" TabIndex="1"
                SelectionMode="Multiple">
            </asp:ListBox>
        </p>
        <p class="error_msg">
            <asp:Label ID="lblHospitalError" runat="server"></asp:Label>
        </p>
    </div>
</div>

I appreciate all your helpful inputs. Just let me know if I should post an image of what it looks like currently. It shows 3 and a bit default.

Upvotes: 2

Views: 5958

Answers (2)

bostonsqd
bostonsqd

Reputation: 116

Try to add Rows="10" into the ListBox

 <asp:ListBox> 
        ID="lstHospital"
        Rows="10" 
        ....
        SelectionMode="Multiple">
    </asp:ListBox>

Upvotes: 2

Zoran Bosnjak
Zoran Bosnjak

Reputation: 346

Rows="10" should work. You can use CSS to style it too...

#lstHospital { height: 200px;}

Be sure it fits within the popup (define the min height for pop-up itself).

Upvotes: 3

Related Questions