Reputation: 91
I would like to hide a length of characters in my Telerik RadListBox ListItems.
Example: (RadListBox Items)
Welcome1
Welcome2
Welcome12345678910
In my case, if the character length is more than 7, I want to show dot dot.
For example Welcome1...
When I mouse over Welcome1...
, the Tooltip needs to show Welcome12345678910
How can this be achieved?
Upvotes: 0
Views: 204
Reputation: 1137
If you're using WebForms you could use something like this approach from the example below...
Markup
<telerik:RadListBox runat="server" ID="rlb" OnItemDataBound="rlb_ItemDataBound"/>
Code Behind
protected void rlb_ItemDataBound(object sender, RadListBoxItemEventArgs e)
{
const int maxLength = 8;
if (e.Item.Text.Length <= maxLength) return;
e.Item.ToolTip = e.Item.Text;
e.Item.Text = string.Format("{0}...", e.Item.Text.Substring(0, maxLength));
}
Upvotes: 1