Last post Jan 24, 2017 10:24 AM by Y2KPRABU
Aug 11, 2011 08:51 PM|jaismile|LINK
Hi All !
Once again i need your help
I am using two listbox side by side with add remove list item one to another,
the list items are too long its containg the name of colleges,my problem is when the name is large in text it is unable to visible compeletely.
i want to wrap or break the text of list items into two line ,so that it can be view properly.
if u have any other idea,to solve this issue please help.
Aug 11, 2011 09:43 PM|Gatsy|LINK
Just create a function to limit the number of text to display on your textbox. If it is coming from DB, you can edit the select query.
Aug 11, 2011 09:46 PM|fayaz_3e|LINK
Technically you can not do. If you are OK with horizontal scroll, then you can wrap the ListBox in div set its overflow. If you dont like horizontal scroll(Yes I never liked horizontal scrolls), You can shorten the text in listbox and set full name as tooltip(title).
You got two options but both are workarounds :).
Jan 24, 2017 10:24 AM|Y2KPRABU|LINK
we can use a asp:DataList control instead of Listbox
<asp:DataList ID="DataList1" runat="server" DataSourceID="[nameofthedatasource]" OnSelectedIndexChanged="DataList1_SelectedIndexChanged" RepeatLayout="Flow" ShowFooter="False" BorderColor="Black" GridLines="Vertical">
<AlternatingItemStyle BackColor="Green" ForeColor="Maroon" />
<asp:LinkButton style="padding:0;margin:0;background-color:transparent;width:200px;word-wrap:break-word;text-decoration:none;height:auto" ID="btnNested" runat="server" Text='<%# Eval("path") %>'/>
<SelectedItemStyle BackColor="Yellow" ForeColor="Navy" />
Replace the [nameofthedatasource] with any datasource or remove the attribute and setit programmatically in codebehind
Replace [path] with the property name which is to be bound