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

Customize Ajax for RadTreeView

3 Answers 85 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ed Bassin
Top achievements
Rank 1
Ed Bassin asked on 01 Jul 2008, 08:12 PM
Hello,

I have server code which changes the text of a node in my tree view.

If I use this line of code inside the AjaxManager:
 <telerik:AjaxUpdatedControl ControlID="optionsTree" LoadingPanelID="AjaxLoadingPanel1"></telerik:AjaxUpdatedControl> 

the tree takes about 5 seconds to load.  (it is a pretty big tree).

What I was trying to do is dynamically set the controlID of this AjaxUpdatedControl to the specific RadTreeNode I was updating.  The succeeded in displaying the loading panel at the right time, but when it finished loading, the tree node did not display the new value.

How do I make this dynamic solution work OR make the other solution fast enough?

Thanks

3 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 04 Jul 2008, 01:55 PM
Hi Ed,

The dynamic AJAX setting may added too late in the page lifecycle, thus the failed update on the client. Basically, if a control is not updated after AJAX (and is updated in case of temporary disabled AJAX -- EnableAJAX set to false) this means there is an AJAX setting is missing the updated control. So can you elaborate more on when do you add the AJAX setting and how? Can you post just the relevant code?

Although I'm not sure why you get the performance issue with the RadTreeView, you can try the suggestions from this help article.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ed Bassin
Top achievements
Rank 1
answered on 07 Jul 2008, 02:19 PM

So that you can have a better idea of what is going on, I have uploaded a screenshot which can be found at:

http://i29.tinypic.com/2zfkftf.jpg

This is the process:
1. The user clicks on one of the tree nodes.
2. Ajax loads the content in the Description and Schema Editor

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="optionsTree">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="descriptionLabel" LoadingPanelID="AjaxLoadingPanel1">  
                </telerik:AjaxUpdatedControl> 
                <telerik:AjaxUpdatedControl ControlID="schemaEditor" LoadingPanelID="AjaxLoadingPanel1">  
                </telerik:AjaxUpdatedControl> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="commit">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="schemaEditor" LoadingPanelID="AjaxLoadingPanel1">  
                </telerik:AjaxUpdatedControl> 
                <telerik:AjaxUpdatedControl ControlID="optionsTree">  
                </telerik:AjaxUpdatedControl> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 

3. The user makes some change like changing the value to "betos3".
4. The user presses the commit button at which point:
    The value is posted back to the server.
        The server's database is updated.
        The server's "stfield" treenode is updated to reflect the new value.

With the ajax code shown above, everything works as expected, but it seems to reload the entire tree very time which takes a while.  What I have been trying to do is delete the commit ---> optionsTree  part of the ajax code and just ajaxify the single RadTreeNode that is being updated.

The following code is taken from optionsTree_NodeClick

RadTreeNode selected = optionsTree.SelectedNode;   
 
if (RadAjaxManager1.AjaxSettings[1].UpdatedControls.Count == 1) {  
            editingNodeAjax = new AjaxUpdatedControl();  
            RadAjaxManager1.AjaxSettings[1].UpdatedControls.Add(editingNodeAjax);  
 }  
  editingNodeAjax.ControlID = selected.ClientID;  
  editingNodeAjax.LoadingPanelID = "AjaxLoadingPanel1"

I hope this helps you see what I am trying to do.

Thanks
0
Konstantin Petkov
Telerik team
answered on 08 Jul 2008, 07:13 AM
Hi Ed,

Thank you for getting back to us and for explaining the issue in details.

Indeed, you need the commit -> optionsTree setting added to be able to update the treeview on commit button click. However, updating the settings server-side in postback event seems to be done too late to be taken into account from the AJAX Manager.

You can modify the AJAX Settings on the client instead. For example, use the OnClientClick of the button or the OnRequestStart Client-Side event.

I hope this helps!

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Ed Bassin
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Ed Bassin
Top achievements
Rank 1
Share this question
or