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

How to reduce master page loading on radpanel clicking

1 Answer 78 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
shanker bangari
Top achievements
Rank 1
shanker bangari asked on 29 May 2010, 10:45 AM
Dear All,

I am using master page for my application to give consistent page layout. I am facing problem whenever i am clicking radpanel my whole page is loading and i am noticing some flickering also. I am using server side coding for radpanel and that radpanel filtering with RadTabStrip. So I want to load only content page on clicking radpanel.I am attaching screenshoot. I want a solution for that.Thankyou..

please i want loading only content page how to solve this . 


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Default.master.cs" Inherits="TelerikComponentsWS.Default" %> 
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
   <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" /> 
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" /> 
   
 
    <title></title
    <link rel="Stylesheet" href="css/styles.css" type="text/css" /> 
  
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server"
        </telerik:RadStyleSheetManager> 
    <telerik:RadScriptManager ID="scm" runat="server" > 
   <Scripts> 
                <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                                     Name="MicrosoftAjax.js" 
                                     Path="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js" /> 
            </Scripts> 
    </telerik:RadScriptManager> 
    <div style="height: 100%;" id="splitterContainer"
         <telerik:RadAjaxManager ID="radAjMan" runat="server" UpdatePanelsRenderMode="Inline" 
           > 
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="horMenu"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="leftMenu" /> 
                        <telerik:AjaxUpdatedControl ControlID="horMenu" LoadingPanelID="logPan"/> 
                       
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                  
            </AjaxSettings>            
        </telerik:RadAjaxManager> 
         
         
        <telerik:radformdecorator id="RadFormDecorator2" DecoratedControls="all" runat="server" decorationzoneid="ZoneID2" 
            skin="Windows7" ControlsToSkip="Select"
        </telerik:radformdecorator> 
         <telerik:radformdecorator id="RadFormDecorator1" DecoratedControls="all" runat="server" decorationzoneid="ZoneID3" 
            skin="Windows7" ControlsToSkip="Select"
        </telerik:radformdecorator> 
       <%-- <telerik:RadWindowManager ID="radWin" runat="server"
            <Windows> 
                <telerik:RadWindow ID="defFacWnd" OffsetElementID='<%#lnk_def_facility.ClientID%>' 
                    OpenerElementID='<%#lnk_def_facility.ClientID%>' NavigateUrl="~/User/DefFacility.aspx" 
                    OnClientClose="onDefFacClose" runat="server"
                </telerik:RadWindow> 
            </Windows> 
        </telerik:RadWindowManager>--%> 
        <telerik:RadFormDecorator ID="rad_decorator" runat="server" DecoratedControls="all" ControlsToSkip="Select"
        </telerik:RadFormDecorator> 
        <telerik:RadSplitter ID="contentSplitter" runat="server" Height="100%" Width="100%" 
          VisibleDuringInit="false" OnClientLoaded="initSplitter"  ResizeWithBrowserWindow="true" LiveResize="false" 
                PanesBorderSize="0" ResizeMode="EndPane"
            <telerik:RadPane ID="navigationPane" runat="server" Width="190" > 
                <div style="margin: 5px;"
                 <br/> 
                    <asp:Image ID="Image2" runat="server" ImageUrl="~/img/company_logo.jpg" /> 
                     
                    
                    <br /> 
                  <%--  <asp:LinkButton ID="lnk_def_facility" runat="server"></asp:LinkButton>--%> 
                </div> 
                
                <telerik:RadPanelBar ID="leftMenu" runat="server" Width="180px"
                </telerik:RadPanelBar> 
                 
                 <br/> 
                 <br/> 
                  <br/> 
                  
                <div > 
                <asp:Button runat="server" ID="btn_logout" Text="Logout"  CausesValidation="false" />   
                </div> 
            </telerik:RadPane> 
            <telerik:RadSplitBar ID="splitter" runat="server" CollapseMode="Forward"  /> 
            <telerik:RadPane ID="contentPane" runat="server" MinWidth="400"
             
                <div style="margin: 5px;"
                  <div id="ZoneID4" style="right: auto"
                <fieldset width="100%" style="border-style: none; padding-right: inherit;"  align="right"
                    <asp:Image ID="Image1" runat="server"  
                        ImageUrl="~/img/studentdatasuite_header.jpg" />  
                    </fieldset> 
                    </div> 
                   
                    <telerik:RadTabStrip ID="horMenu" runat="server" SelectedIndex="0" DataFieldID="module_id"
                        <DataBindings> 
                            <telerik:RadTabBinding TextField="module" ValueField="module_id" /> 
                        </DataBindings> 
                    </telerik:RadTabStrip> 
                   
                    
                </div> 
                <div style="margin: 5px;"
                 <asp:Panel ID="Panel1" runat="server"
                    <h2> 
                        <asp:Literal runat="server" ID="ltTitle"></asp:Literal></h2
                    <asp:ContentPlaceHolder ID="centerContent" runat="server"
                     
                    </asp:ContentPlaceHolder> 
                     </asp:Panel> 
                </div> 
                <div id="ZoneID3" style="right: auto"
                <fieldset width="100%" style="border-style: none; padding-right: inherit;"  align="center"
                    <p> © 2009 Sama IT Group. All rights reserved. 
                            <target="_self" title="Home" href="http://www.samaitgroup.com/">Home</a>  
                            <target="_self" title="Products" href="http://www.samaitgroup.com/products.html">Products</a>  
                            <target="_self" title="Aboutus" href="http://www.samaitgroup.com/aboutus.html">Aboutus</a> 
                            <target="_self" title="Support" href="http://www.samaitgroup.com/support.html">Support</a> 
                            <target="_self" title="Contacts" href="http://www.samaitgroup.com/contactus.html">Contacts</a> 
                            <asp:Label runat ="server" ID"lblLabel"></asp:Label> 
                       </p> 
                    </fieldset> 
                    </div> 
                 
            </telerik:RadPane> 
        </telerik:RadSplitter> 
       
        <telerik:RadAjaxLoadingPanel ID="logPan" runat="server" IsSticky="true" Transparency="30" 
            Style="position: absolute; top: 0; left: 0; line-height: 60px; text-align: center; 
            z-index: 99;" Width="100%" Height="100%" BackColor="#B9CDF7"
            <%--<asp:Image ID="img" runat="server" Width="130px" Height="60px" ImageUrl="~/img/loading.gif" 
                Style="border: 0; margin-top: 70px;"></asp:Image>--%> 
        </telerik:RadAjaxLoadingPanel> 
      
                     
                     
                 
    </div> 
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1"
    <script type="text/javascript"
//        function onDefFacClose(oWnd) {            //get the transferred arguments 
//            var arg = oWnd.argument; 
//            if (arg) { 
//                var facName = arg.facName; 
//                $get(oWnd.get_openerElementID()).innerHTML = facName
//            } 
//        } 
        function initSplitter(sender, args)   
        {          
            sender.get_element().style.visibility = 'inherit';   
        }   
  
    </script> 
    
</telerik:RadScriptBlock> 
    </form> 
</body> 
</html> 
 
using System; 
using System.Linq; 
using Telerik.Web.UI; 
using TelerikComponentsWS.Common; 
using TelerikComponentsBL; 
using System.Web.UI; 
using System.Configuration; 
namespace TelerikComponentsWS 
    public partial class Default : System.Web.UI.MasterPage 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if(!IsPostBack) 
            { 
                navigationPane.Collapsed = !Membershipment.IsUserLogged; 
                if (!Membershipment.IsUserLogged) 
                { 
                    //btn_logout.Visible = false; 
                } 
                RebindTabs(); 
                
            } 
            horMenu.TabClick += new Telerik.Web.UI.RadTabStripEventHandler(horMenu_TabClick); 
            //btn_logout.Click += new EventHandler(btn_logout_Click); 
 
            string display = ConfigurationManager.AppSettings["Display"].ToString(); 
            if (display == "1"
            { 
                //lblLabel.Visible = true; 
 
            } 
            else 
            { 
                //lblLabel.Visible = false; 
               
            } 
        } 
        
       void btn_logout_Click(object sender, EventArgs e) 
        { 
            Membershipment.SignOut(); 
            Response.Redirect(CommonMethods.ResolveUrl("Login.aspx")); 
        } 
        void horMenu_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e) 
        { 
            OnModuleChanged(e.Tab.Value.GetInteger()); 
        } 
        private void RebindTabs() 
        { 
            int? module = null
            if (LogonDetails.Instance.MenusSet != null
            { 
                var modules = LogonDetails.Instance.MenusSet.Modules; 
                horMenu.DataSource = modules; 
                if (modules.Count() > 0) 
                { 
                    module = modules[0].module_id; 
                } 
            } 
            else 
            { 
                horMenu.DataSource = null
            } 
          
                horMenu.DataBind(); 
            
            if (LogonDetails.Instance.MenusSet != null
            { 
                if (Page is Screen) 
                { 
                    var screen = LogonDetails.Instance.MenusSet.MenuItems.FirstOrDefault(mi => mi.screen_id == (Page as Screen).ScreenId); 
                    if (screen != null
                    { 
                        module = screen.module_id; 
                        SelectModule(module); 
 
 
                        SetupTitle(screen.screen); 
                    } 
                } 
            } 
 
            OnModuleChanged(module); 
            if (Page is Screen) 
            { 
                SelectScreen((Page as Screen).ScreenId); 
            } 
        } 
 
        private void SetupTitle(string title) 
        { 
            ltTitle.Text = title; 
            Page.Title = title; 
        } 
 
        private void SelectScreen(int screenID) 
        { 
            foreach (RadPanelItem groupPanel in leftMenu.Items) 
            { 
                foreach (RadPanelItem screenItem in groupPanel.Items) 
                { 
                    if (screenItem.Value.GetInteger() == screenID) 
                    { 
                        groupPanel.Expanded = true
                        return
                    } 
                } 
            } 
        } 
 
        private void SelectModule(int? module) 
        { 
            if (module.HasValue) 
            { 
                var tab = horMenu.Tabs.Where(t => t.Value == module.Value.ToString()).FirstOrDefault(); 
                if (tab != null
                { 
                    if (!tab.Selected) 
                    { 
                        tab.Selected = true
                        OnModuleChanged(module); 
                    } 
                } 
                
            } 
        } 
 
 
 
        private void OnModuleChanged(int? module) 
        { 
            if (module.HasValue) 
            { 
                leftMenu.Items.Clear(); 
                if (LogonDetails.Instance.MenusSet != null
                { 
                    var items = LogonDetails.Instance.MenusSet.ModuleMenuItems(module.Value).OrderBy(item => item.link_group_sequence); 
                    var groups = items.GroupBy(item => item.link_group); 
                    foreach (var group in groups) 
                    { 
                        RadPanelItem groupPanel = new RadPanelItem(group.Key); 
                        var orderedGr = group.OrderBy(gr => gr.link_name_sequence); 
                        foreach (var item in orderedGr) 
                        { 
                            RadPanelItem itemPanel = new RadPanelItem(item.link_name); 
                            itemPanel.Value = item.screen_id.ToString(); 
                            itemPanel.NavigateUrl = item.location_link; 
                            groupPanel.Items.Add(itemPanel); 
                        } 
                        leftMenu.Items.Add(groupPanel); 
                    } 
                } 
            } 
        } 
     
         
    } 
 

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 01 Jun 2010, 03:09 PM
Hi shanker bangari,

If the panelBar is in the masterPage and it's used for navigation, then it's not possible to prevent the postbacks that occur. The solution to such performance issue would be to move the functionality from masterPage to a regular content page and to place the content that you want to be loaded on demand (click in the panelBar) in a AjaxPanel. Then only the needed will be updated and no postback will occur.

Hope this is going to help you!


Regards,
Nikolay Tsenkov
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.
Tags
PanelBar
Asked by
shanker bangari
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or