RadTreeView Refresh on Button Click Event

4 posts, 0 answers
  1. Nitin Koka
    Nitin Koka avatar
    3 posts
    Member since:
    Oct 2009

    Posted 03 Dec 2009 Link to this post

    Hello All,

    I am trying to use the RadTreeView for a web application that i am building. I am using the TreeView to bind with a Table. Currently when i first Click on a button, the table gets populatd with some information. Once that process is completed the RadTreeView renders and displays correctly.

    My Problem is when i enter something else into the text box and click on the button. The Table which is bound to the RadTreeView changes because it needs to display different information, the problem is that the treeview does not get updated with the new data that is present in the table.

    Can someone Please let me know how i can have the treeview refresh on a click event.


  2. Yana
    Yana avatar
    4603 posts

    Posted 04 Dec 2009 Link to this post

    Hello Nitin Koka,

    You can call DataBind method for the treeview in order to rebind.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Varun
    Varun avatar
    8 posts
    Member since:
    Apr 2011

    Posted 05 Dec 2011 Link to this post


    I am also facing this problem but only the difference is I am trying to refresh the tree on the context menu click on server side.

    <telerik:RadAjaxPanel ID="radAjaxPanel" runat="server" EnablePageHeadUpdate="false"
        HorizontalAlign="NotSet" OnAjaxRequest="RadAjaxPanel_AjaxRequest" >

     <telerik:RadTreeView ID="attachmentTreeView" runat="server" 
            EnableEmbeddedSkins="false" AllowNodeEditing="true" AppendDataBoundItems="true"
            DataFieldID="ObjFileId" DataFieldParentID="ParentObjFileId" DataTextField="ObjFileName"
            DataValueField="ObjFileId" OnNodeDataBound="AttachmentTreeView_NodeDataBound"
            OnClientContextMenuShowing="TreeClientContextMenuShowing" OnClientContextMenuItemClicking="TreeClientContextMenuClicking">
                <telerik:RadTreeNode ID="rootNode" AllowDrag="false" AllowEdit="false" Category="RootFolder"
                    Expanded="true" ImageUrl="~/client/Images/Folder.gif" HoveredCssClass="TreeRoot"
                    SelectedCssClass="TreeRoot" ContextMenuID="folderContextMenu" />

    var sortedAttachments = from r in attachmentsDS.ObjFile.AsEnumerable()
                                        orderby r.ObjFileTyp == folderObjectType ? "1" : "2", !r.IsObjFileChkOutUserNull() ? "1" : "2", r.ObjFileName                                ascending
                                        select r;
                 DataView dv=new DataView();
                dv.ApplyDefaultSort = false;
                dv= sortedAttachments.AsDataView();
                attachmentTreeView.DataSource = null;
                attachmentTreeView.DataSource = dv;

    On page load I am calling this code and also on context menu click I am calling it . by data  is updating properly by tree is not refreshing. Please let me know how to proceed further on it ASAP. 

  4. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 06 Dec 2011 Link to this post

    Hi Varun,

    I think that either the data source is not updated, yet, or the entities that you make a query to are staying cached instead of being requested from the source.

    Please, check both of the possibilities.

    Nikolay Tsenkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top