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

Values And Load On Demand

2 Answers 62 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin Watkins
Top achievements
Rank 1
Kevin Watkins asked on 12 Apr 2010, 10:58 AM
Hi,

In some of my now increasingly complex trees I'm persisting whether nodes are expanded or collapsed to the database. I'm doing this by wiring up some JavaScript code to the OnCollapse and OnExpand event. These get the ID of the node and make an AJAX request to the server, this stores the state of the node. And it all works fine. The only downside is that I have to store and retrieve the node ID in two different ways depending on whether the node was in the page when it was first rendered or I've loaded it on demand.

When the node is rendered with the page I use TreeViewItem.HtmlAttributes property to store the node ID in an attribute on the <li> tag. This is because the TreeViewItem.Value doesn't appear in the page anywhere so I have to store it elsewhere.

When the node has been loaded on demand then TreeViewItem.Value is stored in a hidden field and I use that to retrieve the ID. I can't use attributes there because they are ignored when the new nodes are rendered.

As I say my code works so don't worry too much, but can you recommend any way to improve my code? I'd ideally like to be able to treat nodes the same whether they've been rendered with the page or loaded on demand.

Cheers,

Kev

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 12 Apr 2010, 01:02 PM
Hello Kevin,

If I understand you correctly the problem which makes your implementation more complex is the missing hidden field for the value. If you are using the official release of the Telerik Components for ASP.NET MVC (2010.1.309) the aforementioned issue is a known and it is fixed in the latest build.

The fixes will be included in our next service pack, which is scheduled for the middle of the April.

Kind regards,
Georgi Krustev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kevin Watkins
Top achievements
Rank 1
answered on 12 Apr 2010, 01:04 PM
Yeah, that would fix it for me.

Thanks,

Kev
Tags
TreeView
Asked by
Kevin Watkins
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Kevin Watkins
Top achievements
Rank 1
Share this question
or