ricastro
ricastro

Reputation: 422

Telerik MVC Splitter maintain state when page is submitted

I'm using a Telerik MVC Splitter like this:

@(Html.Telerik().Splitter().Name("MainSplitter") _
            .Orientation(SplitterOrientation.Horizontal) _
            .HtmlAttributes( New With { .style = "height: 100%;" }) _
            .Panes(Sub(p)
                          p.Add().Collapsible(True).Size("15%").Content(Html.Partial("Menu").ToHtmlString)
                          p.Add().Content(RenderBody().ToHtmlString)
                  End Sub))

When i collapse the menu pane i want it to stay collapsed even when i navigate trought pages. Is it possible to maintain the state of the splitter when refreshing page or when the user navigates between pages?

Upvotes: 0

Views: 486

Answers (1)

VJAI
VJAI

Reputation: 32758

Basically you want to maintain the state of the control. I'm not sure whether Telerik MVC controls supports this in a built-in way(please confirm that).

You can use two ways to store the state of the controls either you can use cookie or html5 local storage.

You can either listen to the client side events of the Splitter and update the state into the local storage or cookie else in the window unload event you can get the store and store it.

When the page loads you have to reset the state from the cookie/local storage.

for ref: http://www.telerik.com/support/kb/aspnet-mvc/treeview/persisting-treeview-state-in-cookie.aspx

Upvotes: 1

Related Questions