tooltip and dropdownlist

8 posts, 0 answers
  1. Dave
    Dave avatar
    42 posts
    Member since:
    Jan 2008

    Posted 15 Jan 2008 Link to this post

    How do I implement the radtooltip for use on a dropdownlist?  I have a dropdownlist that is populated from an access database.  I am showing the abbreviations for the job types as the "Text" of the dropdownlist.  I would like to show the descriptions of the job types in a tooltip as the user mouses over each selection.  I am coding in VB.

    Thank you,
    Dave Durose
  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 16 Jan 2008 Link to this post

    Hello Dave,

    In case you review the HTML that represents the DropDownList control, you will notice that it is something like:

    SELECT
    -OPTION
    -OPTION

    As the OPTION element is not a real HTML object, it cannot be configured to display even the plain [browser] tooltip. That is why, there is no way to make the manager tooltipify the items of the DropDownList - as it cannot find those, and they do not trigger mouse events that the tooltip uses to display itself.

    In case you decide to use a RadCombo to display your data, it will be possible to tooltipify the items.

    Kind regards,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Tree
    Tree avatar
    111 posts
    Member since:
    Nov 2005

    Posted 20 Jan 2008 Link to this post

    OK, so how does one tooltipify RadComboBox items?  Can you show me how to do it for RadCombBox templated items. 

    I have template that includes a checkbox, the item text, and an "?" icon.  I want to display the tooltip when the user hovers over the "?" icon.
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Jan 2008 Link to this post

    Hello Eriksson,

    This is possible to do, and we will gladly help you with this.
    Our suggestion is to fully implement your scenario, so that the default browser tooltip would appear over each image, and show the required information.

    Once you are done with it, please open a support ticket and send us a working project. We will make the necessary changes to use RadToolTip and send it back to you.

    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Dave
    Dave avatar
    42 posts
    Member since:
    Jan 2008

    Posted 21 Jan 2008 Link to this post

    I am trying to do the same thing as Eriksson (adding RadTooltips to a RadComboBox).  I would love to add a "?" icon next to each option in the drop-down that when moused over would show a description of the option.  Eriksson - could you show me the code that you implemented to do this?  Or perhaps I could get the necessary code from Telerik.  Either way.  Please let me know.

    Thanks,
    Dave
  6. Tree
    Tree avatar
    111 posts
    Member since:
    Nov 2005

    Posted 21 Jan 2008 Link to this post

    Good timing!  I just just finished this and it seems to work crudely.

    I create a tooltip in a radcomboitem template and set its text property during radcomboitem databind event.

    Note that in the databind event handler I am extracting the text to show in the tooltip (actually html markup in my case) from the 6th character onwards of the RadComboItem.Value member.  This is because I actually store two things in the Value string: an Id that is 0-padded to 5 characters, and then the tooltip.  I use the Id for an url parameter when user clicks the item.

    Trust that this all makes sense

    E

    <p>
    Filter by Domain:
    <rad:RadComboBox
    ID="RadComboBox_Domains"
    Width="450px"
    runat="server">
    <ItemTemplate>
    <%# DataBinder.Eval(Container, "Text")%>
    &nbsp;
    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/question-small.png" />
    <telerik:RadToolTip
    ID="RadToolTip1"
    runat="server">
    </telerik:RadToolTip>
    </ItemTemplate>
    </rad:RadComboBox>
    </p>

    Then in my aspx.cs file:

    protected void CategoryRadComboBoxes_ItemDataBound(object o, RadComboBoxItemDataBoundEventArgs e)
    {
    //DataRowView dataSourceRow = (DataRowView)e.Item.DataItem;

    String QuestionMarkImageClientID = e.Item.FindControl("Image1").ClientID;
    ((RadToolTip)e.Item.FindControl("RadToolTip1")).IsClientID = true;
    ((RadToolTip)e.Item.FindControl("RadToolTip1")).TargetControlID = QuestionMarkImageClientID;
    ((RadToolTip)e.Item.FindControl("RadToolTip1")).Text = e.Item.Value.Substring(5);
    ((RadToolTip)e.Item.FindControl("RadToolTip1")).Sticky = false;
    }
  7. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Jan 2008 Link to this post

    Hello Eriksson,

    You have taken the right approach, and we are glad to see you were able to succeed on our own.
    Should other questions arise, do not hesitate to contact us.

    One thing we would recommend is optimizing the code - create a reference to the tooltip
    RadToolTip tip = ((RadToolTip)e.Item.FindControl("RadToolTip1"));

    Then use it to set all required properties. Also - the  Sticky property is false by default, so you do not need to set it explicitly.

    Greetings,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Tree
    Tree avatar
    111 posts
    Member since:
    Nov 2005

    Posted 21 Jan 2008 Link to this post

    Tervel,  Thanks for taking the time to review my code and to suggest improvements.
Back to Top