tina
tina

Reputation: 225

Save Telerik treeview state

I'm working with a telerik.dll library and I just want to be able to save the opened node after a post.

My view source looks like:

<div class="span-5 column">
    <div class="TreeView">
        <% if (Request.IsAuthenticated) { %>
            <p>Bienvenid@ <b><%= Html.Encode(Page.User.Identity.Name) %></b></p>
        <% } %>
        <br/>
        <%= Html.Telerik().TreeView()
                          .Name("TreeView")
                          .BindTo("menuApp")
        %>
    </div>
</div>

I read that I had to set two variables (EnableViewState and RetainScrollPosition) to true, but how can I do that??

Upvotes: 0

Views: 1646

Answers (2)

carlbergenhem
carlbergenhem

Reputation: 1989

From your code snippet I'm assuming that you are working with the Telerik Extensions for ASP.NET MVC. The proper approach to this would be to attach JavaScript handlers to the OnExpand and OnCollapse client-side events and within these events populate a cookie which would maintain the state. There is actually a knowledgebase article regarding this on Telerik's website, and I think if you follow the solution in that article you should be able to persist the expanded state of your nodes!

Upvotes: 1

LaGrandMere
LaGrandMere

Reputation: 10379

I'm not sure it will answer your question.

Can't you save the Treeview.SelectedNode and Scroll to it (Telerik Treeview How-to) after your post ?

Upvotes: 0

Related Questions