【问题标题】:Telerik RadListBox Item list how to hide character length and show tooltip?Telerik RadListBox 项目列表如何隐藏字符长度并显示工具提示?
【发布时间】:2015-09-10 09:19:06
【问题描述】:

我想在 Telerik RadListBox ListItems 中隐藏一段字符。

示例:(RadListBox 项)

Welcome1
Welcome2
Welcome12345678910

在我的情况下,如果字符长度超过 7,我想显示点点。

例如Welcome1...

当我将鼠标悬停在Welcome1... 上时,工具提示需要显示Welcome12345678910

如何做到这一点?

【问题讨论】:

    标签: javascript c# jquery asp.net telerik


    【解决方案1】:

    如果您使用的是 WebForms,则可以使用以下示例中的类似方法...

    标记

    <telerik:RadListBox runat="server" ID="rlb" OnItemDataBound="rlb_ItemDataBound"/>
    

    代码背后

    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));
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-02
      • 2018-06-20
      • 2011-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多