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.

    Thanks

    Nitin
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 04 Dec 2009 Link to this post

    Hello Nitin Koka,

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

    Greetings,
    Yana
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. Varun
    Varun avatar
    8 posts
    Member since:
    Apr 2011

    Posted 05 Dec 2011 Link to this post

    Hi 

    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"
            OnContextMenuItemClick="AttachmentTreeView_ContextMenuItemClick"
            OnClientContextMenuShowing="TreeClientContextMenuShowing" OnClientContextMenuItemClicking="TreeClientContextMenuClicking">
            <Nodes>
                <telerik:RadTreeNode ID="rootNode" AllowDrag="false" AllowEdit="false" Category="RootFolder"
                    Expanded="true" ImageUrl="~/client/Images/Folder.gif" HoveredCssClass="TreeRoot"
                    SelectedCssClass="TreeRoot" ContextMenuID="folderContextMenu" />
            </Nodes>

            <ContextMenus>
    .............
            </ContextMenus>
    -----------------
    Code:-
    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;
                attachmentTreeView.DataBind();

    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. 




  5. Nikolay Tsenkov
    Admin
    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.


    Regards,
    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