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

Treeview Databind Complete Event

2 Answers 101 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
robertgalvinjr
Top achievements
Rank 1
robertgalvinjr asked on 28 Jan 2010, 09:13 PM
I am using a RadTreeview with a LINQ (to SQL) datasource. I would like to know is there a way to detect when the data has completely loaded? I need to have certain nodes prechecked and realize I can do this within the nodedatabound event, but I want to basically:

-Wait until the full data load has completed (so all children are present)
-Check a node like a user/client would have (and have all of the corresponding actions to happen)

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 29 Jan 2010, 03:10 PM
I think one of the better events to do this in is either the OnClientLoad event (client-side) or the OnLoad server-side event. I know that the data has at least fully loaded by then. Are you looking to set a checkbox as checked and then have the usual event sequence fire?
0
robertgalvinjr
Top achievements
Rank 1
answered on 29 Jan 2010, 03:18 PM
Thanks for reply - I actually just did this from the client side by hooking into the OnLoad for the Body tag. Also coupled it wuth the AjaxRequest to make it all happen.

<body onload="SetChecked()">  
<telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">  
 
 
    <script type="text/javascript">  
        function SetChecked() {  
            var tree = $find("<%= tvCategories.ClientID %>");  
            var node = tree.findNodeByValue("<%= preSelectedNodeID %>");  
            if (node) {  
                node.check();  
                node.set_expanded(true);  
                var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");  
                ajaxManager.ajaxRequest("client");  
                  
 
                }  
            }  
          
        </script> 
    </telerik:RadCodeBlock> 
     


And then in the code behind just did a rebind of the data so the correpsonding ListView updated based on the checked nodes:
 protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)  
    {  
        lvPPT.DataBind();  
    } 


Also had to add an AjaxSetting manually to get the display to fresh:
<telerik:RadAjaxManager runat="server"   
        DefaultLoadingPanelID="RadAjaxLoadingPanel1" EnableHistory="True"   
        ID="RadAjaxManager1" 
        OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="tvCategories" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
 
...       
Tags
TreeView
Asked by
robertgalvinjr
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
robertgalvinjr
Top achievements
Rank 1
Share this question
or