Adding ToolTip to RadComboBox Programmatically

4 posts, 0 answers
  1. Joe
    Joe avatar
    23 posts
    Member since:
    Nov 2010

    Posted 08 Sep 2011 Link to this post

    Im attempting to build a combobox and populate it with data. everything works, but I would also like to add tooltips using data from my database. My code is as follows:
    radcombo_mns_severity.DataTextField = "SEVERITY";
    radcombo_mns_severity.DataValueField = "ID";
    radcombo_mns_severity.ToolTip = "DESC";
    radcombo_mns_severity.DataSource = from c in quarkdb.MNS_SEVERITies
                                       orderby c.SEVERITY
                                       select new

    Is there away to do this?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Sep 2011 Link to this post

    Hello Joe,

    You can easily achieve this by using RadToolTip inside ItemTemplate. Here is a sample code.

    <telerik:RadComboBox ID="RadComboBox1" runat="server" EmptyMessage="Select" DataTextField="Name">
             <asp:Label runat="server" ID="Label1" Text='<%# Eval("Name")%> '></asp:Label>
             <telerik:RadToolTip ID="RadToolTip1" runat="server" Width="100" Height="10" TargetControlID="Label1" Position="BottomRight" Text='<%# Eval("Name")%>'>

    protected void Page_Load(object sender, EventArgs e)
           RadComboBox1.DataSource = CreateDataSource();
           RadComboBox1.DataTextField = "Name";
           RadComboBox1.DataValueField = "ID";
       protected DataTable CreateDataSource()
           DataTable dataTable = new DataTable();
           dataTable.Columns.Add(new DataColumn("ID", typeof(string)));
           dataTable.Columns.Add(new DataColumn("Name", typeof(string)));
           DataRow dr = dataTable.NewRow();
           dr["ID"] = "1";
           dr["Name"] = "FirstName1LastName1";
           DataRow dr2 = dataTable.NewRow();
           dr2["ID"] = "2";
           dr2["Name"] = "FirstName2LastName2";
           return dataTable;

  3. Joe
    Joe avatar
    23 posts
    Member since:
    Nov 2010

    Posted 08 Sep 2011 Link to this post


    Thanks for the response.

    Im not sure that I follow. I see in your example that you have 2 columns listed (ID & Name). The Name column is associated with text field of the combobox. You are then using it for the Tooltip. What if you have a 3rd column (in my case, the tooltip is a description (DESC) of the severity (SEVERITY) column)? Would I simply swap the <%# Eval("Name")%> with <%# Eval("DESC")%>?
  4. Ivana
    Ivana avatar
    657 posts

    Posted 13 Sep 2011 Link to this post

    Hi Joe,

    Yes, if you simply swap <%# Eval("Name")%> with <%# Eval("DESC")%> it  will work if "DESC" is name of a column in the data table you are getting data from.

    Best wishes,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top