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

RadTreeView Refresh on Button Click Event

3 Answers 170 Views
This is a migrated thread and some comments may be shown as answers.
Nitin Koka
Top achievements
Rank 1
Nitin Koka asked on 03 Dec 2009, 03:00 PM
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

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 04 Dec 2009, 10:44 AM
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.
0
Varun
Top achievements
Rank 2
answered on 05 Dec 2011, 01:48 PM
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. 




0
Nikolay Tsenkov
Telerik team
answered on 06 Dec 2011, 06:16 PM
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
Asked by
Nitin Koka
Top achievements
Rank 1
Answers by
Yana
Telerik team
Varun
Top achievements
Rank 2
Nikolay Tsenkov
Telerik team
Share this question
or