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

Tree Integration with Tooltip and Adding Node Client Side

3 Answers 80 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Feizal Amlani
Top achievements
Rank 1
Feizal Amlani asked on 03 May 2009, 12:19 AM
Hello,

I am using your example at

http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltiptreeview/defaultcs.aspx

To have a treeview launch tooltips.  I have some javascript code to Add a Node client side.  This works as expected.  I have the identical code you have in the markup page OnClientMouseOver(..) that gets called when the user goes over the node.  The problem is that the Ajax event does not fire for the New Node.  The tooltip does appear though.  The ajax event fires for all the other nodes that were added at start up. 

After some investigation it seems that the "id" attribute needs to be set.  Just like you have done in the RadTreeView_NodeExpand event node.Attributes("id") = Guid.NewGuid().ToString() from your code behind page.  However, trying to set this on the client side does not work.  Adding the node like the following;

   var tree = $find("<%= RadTreeView1.ClientID %>");
   tree.trackChanges();
   var node = new Telerik.Web.UI.RadTreeNode();
   node.set_text("New Node");
   node.get_attributes().setAttribute("id","myid")
   tree.get_nodes().add(node);
   tree.commitChanges();

When I look at the node like so.. node.get_textElement() the id is not set.  However, the rest of the IDs of the other nodes are set.  If I manually set the ID like so... node.get_textElement().id = "myid", the ID gets set correctly and the tooltip and ajax event fires correctly.

I am wondering if I am doing something incorrectly when adding the Node client side and expecting the Ajax event to fire. 

Thanks.

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 May 2009, 08:37 AM
Hello Feizal Amlani,

You can try setting the id of the node like this:

node.get_element().id = "myid";

The "ID" must be applied as an HTML attribute hence that workaround.

All the best,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Feizal Amlani
Top achievements
Rank 1
answered on 04 May 2009, 11:59 PM
Thank for the additional info.

I have a general question regarding loading the user control.  I am following your example in http://demos.telerik.com/aspnet-ajax/tooltip/examples/tooltiptreeview/defaultcs.aspx

Everything works fine when the tooltip needs to be loaded.  The OnAjaxUpdate event fires correctly and I load the usercontrol.  In the Page_Load of the usercontrol I set the Text of the TextBox with the current time.  I then Cancel the tooltip and open a second one.  The time is the same in the textbox and is not updated with the new time.  Even-though in the debugger the value has changed the textbox does not get updated.

If I move the code of updating the textbox from Page_Load to Pre_Render the time gets updated correctly.  I am wonderying why the textbox does not get updated on PageLoad.

This may have to do with the Update Panel have UpdateMode="Conditional".

Thanks.
0
Svetlina Anati
Telerik team
answered on 05 May 2009, 08:40 AM
Hello Feizal,

When we add to the tooltip controls with ViewState we have to make sure that these controls are created before the LoadViewState event fires so that their ViewState information is loaded. In order to avoid forcing our clients to recreate all their controls in the Init event on postback, we decided to fire the AjaxUpdate event earlier in the page lifecycle. That is why the TextBox takes its old data from the ViewState and does not get updated.

In order to get the desired result, you should set the new value in the  PrePender event as you have found yourself.


All the best,
Svetlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
TreeView
Asked by
Feizal Amlani
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Feizal Amlani
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or