Set item tooltips in RadDropDownList

2 posts, 1 answers
  1. Bruce
    Bruce avatar
    17 posts
    Member since:
    Mar 2013

    Posted 05 Jun 2013 Link to this post

    I have a RadDropDownList that I bind to a List of State objects. The DataTextField is set to the state abbreviation property, and the DataValueField is set to a Guid identifier. I want to set the tooltip of the list items to the state name, IE. AK = Alaska. I have tried a few different ways to do this, but none are working. In each case I have stepped through the code to verify that each item gets the proper value assigned to it. In the browser though there are no tool tips.

    Method 1: After calling DataBind() I iterate through each item in the RadDropDownList and assign the state name to the item's ToolTip property.
    List<State> stateList = GetStates();
    uxState.DataSource = stateList;
    foreach (DropDownListItem item in uxState.Items)
        State state = stateList.Find(delegate(State myState)
            return myState.StateId == new Guid(item.Value);
        if (state != null)
            item.ToolTip = state.Name;

    Method 2: Is the same as method 1 except I do all the work inside the DataBound event.

    Method 3: Thinking the issue was something to do with the data binding I iterate the state object list and create new a DropDownListItem for each object. I then assign the tooltip to the new DropDownListItem and add it to the RadDropDownList.Items collection.
    foreach (State state in List<State>)
        DropDownListItem item = new DropDownListItem(state.Abbreviation, state.StateId.ToString());
        item.ToolTip = state.Name;
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Jun 2013 Link to this post

    Hi Bruce,

    Try the following code snippet to set tooltips in RadDropdownList items.
    <telerik:RadDropDownList ID="RadDropDownList1" runat="server" DataTextField="factor">
      <asp:Label runat="server" ID="Label1" Text='<%# Eval("factor")%> '></asp:Label>
      <telerik:RadToolTip ID="RadToolTip1" runat="server" Width="100" Height="10" TargetControlID="Label1" Position="BottomRight" Text='<%# Eval("factor")%>'>
    Note: Databinding in code behind

  3. DevCraft R3 2016 release webinar banner
Back to Top