Horizontal scroll bar problem in Listbox

  • 12 years ago
    Hi...
          I want horizontal scroll bar in Listbox. For that i am using following code.

    <div style="width:120px; overflow-x:auto">
    <asp:listbox id="lstboxvalue" runat="server" width="125px" rows="6" ></asp:listbox>
    </div>

    It gives me horizontal scroll bar. But it truncates some portion of text. The whole text is stored in database but whole isn't reflected here. Can anyone tell me what could be the problem.

    eg. The text stored in database is 'testing by needhi', den it shows only 'testing by ne'.
    Plz help. Its urgent..
  • 12 years ago

    Hi,

    The reason you are getting a scrollbar is because your containing div for the listbox is smaller than the listbox.

    you want to adjust your markup to something like

    <div style="width:120px;>
    <asp:listbox id="lstboxvalue" runat="server" width="120px" rows="6" style="overflow-x:auto;" ></asp:listbox>
    </div>

    HTH

    Regards

    Simon C

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne