Treeview Databind Complete Event

3 posts, 0 answers
  1. robertgalvinjr
    robertgalvinjr avatar
    36 posts
    Member since:
    Jun 2006

    Posted 28 Jan 2010 Link to this post

    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. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 29 Jan 2010 Link to this post

    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?
  3. robertgalvinjr
    robertgalvinjr avatar
    36 posts
    Member since:
    Jun 2006

    Posted 29 Jan 2010 Link to this post

    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> 
     
    ...       
Back to Top