This is a migrated thread and some comments may be shown as answers.

ToolTip is gone after postback

3 Answers 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Udi
Top achievements
Rank 1
Udi asked on 13 Dec 2010, 12:49 PM
Hello,

I have a treeview in a combobox.
When i select a node, the node's text appears in the combobox input field.
In additional i set node's text as a tooltip.

1. Why the first line in the next code snippest doesn't work? (No tooltip appears)
//This line doesn't work for some reason that i don't know.
//comboBox.ToolTip = args.get_node().get_text();
  
//This line work's perfect.
comboBox._element.title = args.get_node().get_text();

2. I added an asp button to the page, after i click the button there is a postback that causes to the tooltip to disapear.
    How can i persist the tooltip?

Thanks,
Oren

3 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 13 Dec 2010, 02:21 PM
Hello Oren,

1. That line doesn't work because there is no property called ToolTip for the RadComboBox on the client-side.
2. To persist the tooltip after the button is clicked, I would suggest setting the ToolTip property of the RadComboBox in the button's click event. So it remains there after the postback.

I hope that helps.
0
Udi
Top achievements
Rank 1
answered on 13 Dec 2010, 02:59 PM
Hi Cori,

1. I have a property named ToolTip for combobox control in the client side.
2. I wouldn't like to set the tooltip in the button click event handler.
    I would like to set it in the treeview "OnClientNodeClicking" event handler after i  click on a node:

function nodeClicking(sender, args)
 {
    var comboBox = $find("<%= combo.ClientID %>");
    var node = args.get_node()
    comboBox.set_text(node.get_text());
    comboBox.trackChanges();
    comboBox.get_items().getItem(0).set_text(node.get_text());
    comboBox.commitChanges();
    comboBox._element.title = args.get_node().get_text();
    comboBox.hideDropDown();
 }

Is it the only way?
I'm looking for another solution,
0
Accepted
Dimitar Terziev
Telerik team
answered on 16 Dec 2010, 03:02 PM
Hi Oren,

In order to set ToolTip on nodeClicking event you could use the following code:
function nodeClicking(sender, args)
{
    var comboBox = $find("<%= RadComboBox1.ClientID %>");
 
 
    var node = args.get_node()
 
    comboBox.set_text(node.get_text());
 
    comboBox.trackChanges();
    comboBox.get_items().getItem(0).set_text(node.get_text());
 
    comboBox.commitChanges();
 
    comboBox.hideDropDown();
    comboBox.get_element().title = args.get_node().get_text();
}
Please note that this ToolTip will not persist over a postback, that's why you should use the following code in the OnClientLoad event of the ComboBox  in order to have the ToolTip after a PostBack:
function comboLoad(sender, args) {
    var treeview = sender.get_items().getItem(0).findControl("RadTreeView1");
    if(treeview.get_selectedNode() != null)
        sender.get_element().title = sender.get_text();
}


All the best,
Dimitar Terziev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
Udi
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Udi
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or