Ticket Q379820
Visible to All Users

MVC Splitter - How to show loading panel on main content pane

created 12 years ago (modified 12 years ago)

[DX Support team: this thread was cloned from GridView - How to set fixed width for a column]
Hi,
i have 2 doubts.
2.I have a vertical menu where each tab loads different grids, so while navigating from one tab to another, its taking sometime(though its a few secs).So how can i add a loading panel there.

Thanks

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

Hi,
I suggest you implement the following scenario:
0) Add MVC LoadingPanel to your View ;

  1. Handle the client-side ASPxClientTabControlBase.BeginCallback event and call the ASPxClientLoadingPanel.Load method in this handler;
  2. Handle the client-side ASPxClientTabControlBase.EndCallback event and call the ASPxClientLoadingPanel.Hide method in the handler.
    Updated:
    As I see, you've got the Splitter control on your page. In this case, I suggest you wrap the Splitter's main content pane with the CallbackPanel and set its content depending on the Menu's clicked item name or index.
    Then, you can use the approach I described before: handle the client-side BeginCallback and EndCallback events of your CallbackPanel and show/hide the LoadingPanel in these handlers.
    Moreover, showing the LoadingPanel over the CallbackPanel where your menu is wrapped does not make sense, since the content controls, like GridView, are loaded in another Splitter Pane.
    I've attached a sample project to demonstrate this approach.
    Show previous comments (9)
    DevExpress Support Team 12 years ago

      Hello,
      You can add

      JavaScript
      lp.Show()

      in the 'onBeginCallback' function. To hide the loading panel, handle the client-side EndCallback event for your CallbackPanel and add

      JavaScript
      lp.Hide()

      code to this handler.

        Sorry i am still confused.Please see my code. I am new to this, help me.
        This is my header partial view
        <script>
            var index;
            function onClick(s, e) {
                index = e.item.index;
                CallbackPanel1.PerformCallback();
            } function onBeginCallback(s, e) {
                e.customArgs["index"] = index;
                index = null;
                lp.show();
            }
        </script>
        <div class="headerMenu">
             @Html.DevExpress().Menu(settings => {
            settings.Name = "Menu";

        settings.AllowSelectItem = true;
            settings.SelectParentItem = true;
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Orientation = System.Web.UI.WebControls.Orientation.Horizontal;
            settings.ClientSideEvents.ItemClick = "onClick";
        }).BindToXML(HttpContext.Current.Server.MapPath("~/App_Data/dsMain.xml"),"//mainmenu/*").GetHtml()
        </div>
        @Html.DevExpress().LoadingPanel(settings => {
            settings.Name = "lp";
            settings.Modal = true;
            settings.ContainerElementID = "CallbackPanel1";
        }).GetHtml()
        //END//
        This is my calbackpanel code:
        @Html.DevExpress().CallbackPanel(settings => {
            settings.Name = "CallbackPanel1";
            settings.CallbackRouteValues = new { Controller = "Home", Action = "CallbackPanel1Partial" };
            settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.Height = System.Web.UI.WebControls.Unit.Percentage(100);
            settings.ClientSideEvents.BeginCallback = "onBeginCallback";
            string siteMapSource = ViewBag.Index!= null ? string.Format("~/App_Data/ds{0}.xml", ViewBag.Index) : string.Format("~/App_Data/ds{0}.xml", 0);
            settings.SetContent(() => {
                Html.DevExpress().Menu(settingsMenu => {
                    settingsMenu.Name = "SubMenu1";

        settingsMenu.AllowSelectItem = true;
                    settingsMenu.Orientation = System.Web.UI.WebControls.Orientation.Vertical;
                    settingsMenu.ClientSideEvents.ItemClick = "OnSubMenuClick";
                    settingsMenu.ItemDataBound = (s, e) => {
                       if( !String.IsNullOrWhiteSpace(e.Item.NavigateUrl)){
                             e.Item.Name = e.Item.NavigateUrl;
                             e.Item.NavigateUrl = null;
                       }
                    };
                }).BindToXML(HttpContext.Current.Server.MapPath(siteMapSource), "//mainmenu/*").Render();
            });
        }).GetHtml()
        //END//
        Please edit my code.
        TIA

        DevExpress Support Team 12 years ago

          Hello,
          Please take special note that Javascript is a case-sensitive language, so it is important to write functions' names correctly.

          JavaScript
          var index; function onClick(s, e) { index = e.item.index; CallbackPanel1.PerformCallback(); } function onBeginCallback(s, e) { e.customArgs["index"] = index; index = null; <bold>lp.Show();</bold> } <bold> function onEndCallback(s,e){ lp.Hide(); }</bold>
          C#
          @Html.DevExpress().CallbackPanel(settings => { settings.Name = "CallbackPanel1"; settings.CallbackRouteValues = new { Controller = "Home", Action = "CallbackPanel1Partial" }; settings.Width = System.Web.UI.WebControls.Unit.Percentage(100); settings.Height = System.Web.UI.WebControls.Unit.Percentage(100); settings.ClientSideEvents.BeginCallback = "onBeginCallback"; <bold> settings.ClientSideEvents.EndCallback="onEndCallback";</bold> .... }).BindToXML(HttpContext.Current.Server.MapPath(siteMapSource), "//mainmenu/*").Render(); }); }).GetHtml() //END//

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.