This question is locked. New answers and comments are not allowed.
Hello
I have a PanelBar in a masterpage (Site.master) and would like to know how to maintain the PanelBar's state between page refreshes.
For example, when the user clicks a link in the panel bar an action is invoked and the appropriate page is displayed, however the PanelBar is re-rendered back to its original state.
I would like to know if there is some javascript which could iterate through the panelbar and compare the URL with the navigateurl property and if they match the item is then selected and expanded. Is this possible and does anyone have an example to share?
Thank you
Adam
Site.master below:
I have a PanelBar in a masterpage (Site.master) and would like to know how to maintain the PanelBar's state between page refreshes.
For example, when the user clicks a link in the panel bar an action is invoked and the appropriate page is displayed, however the PanelBar is re-rendered back to its original state.
I would like to know if there is some javascript which could iterate through the panelbar and compare the URL with the navigateurl property and if they match the item is then selected and expanded. Is this possible and does anyone have an example to share?
Thank you
Adam
Site.master below:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title> <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> </title> <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> <%= Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group.Add("telerik.common.css") .Add("telerik.hay.css")) %></head><body> <div id="header"> <div id="title"> <h1> <img alt="" src="../../Content/Img/aussielogo1.png" /></h1> </div> <div id="logindisplay"> <% Html.RenderPartial("LogOnUserControl"); %> </div> <div id="menu"> <ul> <li> <%: Html.ActionLink("Dashboard", "Index", "Home")%></li> <li> <%: Html.ActionLink("Account", "Home", "Account")%></li> <li> <%: Html.ActionLink("About", "About", "Home")%></li> </ul> </div> </div> <div class="page"> <div id="leftcolumn2"> <asp:ContentPlaceHolder ID="MainContent" runat="server" /> </div> <div id="rightcolumn2"> <div id="rightcolumn2-bgtop"> </div> <div id="rightcolumn2-content"> <% Html.Telerik().PanelBar() .Name("PanelBar") .Items(items => { items.Add().Text("Create").Expanded(true) .Items(subItems => { subItems.Add().Text("Job"); subItems.Add().Text("Customer"); subItems.Add().Text("Estimate"); subItems.Add().Text("Invoice"); subItems.Add().Text("Work Order"); subItems.Add().Text("Purchase Order"); subItems.Add().Text("Supplier"); subItems.Add().Text("Request for Quote"); subItems.Add().Text("Contractor"); }); items.Add().Text("Account") .Items(subItems => { subItems.Add().Text("View Account").Action("ViewAccountDetails", "Account", new { userName = HttpContext.Current.User.Identity.Name }); subItems.Add().Text("Edit Company Details").Action("EditCompanyDetails", "Account"); subItems.Add().Text("Edit Address Details").Action("EditAddressDetails", "Account"); subItems.Add().Text("Edit Personal Details").Action("EditPersonalDetails", "Account"); subItems.Add().Text("Change Password").Action("ChangePassword", "Account"); }); }) .Render(); %> </div> <div id="sidebar-bgbtm"> </div> </div> <div class="clear"> </div> <div id="footer"> <%: Html.ActionLink("Privacy Policy", "ViewPrivacy", "Shared")%> </div> </div> <%= Html.Telerik().ScriptRegistrar() %></body></html>