[CLOSED] Loading Panel content from DirectMethod

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Loading Panel content from DirectMethod

    Hi,

    Please suggest how to load Panel content correctly from a Direct Method if it's possible. I'm getting a client side error doing it as below. Here's my test case:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
            }
        }
    
        [DirectMethod]
        public void LoadContent(string url)
        {
            this.Panel1.SuspendScripting();
            this.Panel1.ClearContent();
            this.Panel1.RemoveAll(true);
            this.Panel1.Loader = new ComponentLoader();
            this.Panel1.Loader.Url = url;
            this.Panel1.Loader.Mode = LoadMode.Frame;
            this.Panel1.Loader.DisableCaching = true;
            this.Panel1.Loader.LoadMask.ShowMask = true;
            this.Panel1.Loader.LoadMask.Msg = "Loading it...";
            this.Panel1.Loader.MonitorComplete = false;
            this.Panel1.LoadContent();
        }
    
    </script>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <title>Ext.NET Examples</title>
        <script>
            var loadContent = function () {
                var url = "Child.aspx";
    
                App.Panel1.clearContent();
    
                X.LoadContent(url, {
                    eventMask: { showMask: false },
                    success: function () {
    
                    }
                });
            };
    
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="X" />
            <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Icon="Book" Title="Ext.Net">
                        <BottomBar>
                            <ext:Toolbar runat="server">
                                <Items>
                                    <ext:Button runat="server" Text="Load Content" Icon="Application">
                                        <Listeners>
                                            <Click Fn="loadContent" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </BottomBar>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    Last edited by Daniil; Sep 14, 2015 at 2:11 PM. Reason: [CLOSED]
  2. #2
    Loading the panel content seems possible from a direct event but not from a DirectMethod. Another hindrance that I'd love to do away with is having to specify the initial Url in the Panel Loader configuration.

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            this.Panel3.LoadContent(new ComponentLoader()
            {
                Url = "Child.aspx",
                Mode = LoadMode.Frame,
                DisableCaching = true
            });
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:Panel
            ID="Panel1"
            runat="server"
            Height="150"
            Width="350"
            Title="Frame Mode">
            <Loader
                runat="server"
                Url="Blank.aspx"
                Mode="Frame"
                ShowMask="true">
                <LoadMask ShowMask="true" />
            </Loader>
            <Buttons>
                <ext:Button runat="server" ID="Button1" Text="Load" OnDirectClick="Button1_Click" />
            </Buttons>
        </ext:Panel>
    </body>
    </html>
  3. #3
    What does the client-side error state?

    I believe X.LoadContent should be App.LoadContent.

    Hope this helps.
    Geoffrey McGill
    Founder
  4. #4
    Hi Geoffrey,

    Thanks for your response. Attached is the screenshot of the client side error. You can run the original test case in this thread provided that Child.aspx page exists. However, my sense is that the error occurs prior to the Url evaluation.

    Click image for larger version. 

Name:	Loader Error.png 
Views:	143 
Size:	30.6 KB 
ID:	24227
  5. #5
    Hi Vadym,

    Please define a Loader stub for the Panel in the sample from the first post.
    <Loader runat="server" AutoLoad="false" />
  6. #6
    Hi Daniil,

    The client error is gone but the panel content doesn't load properly. Anything else is missing or misconfigured?

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
            }
        }
    
        [DirectMethod]
        public void LoadContent(string url)
        {
            this.Panel1.SuspendScripting();
            this.Panel1.ClearContent();
            this.Panel1.RemoveAll(true);
            //this.Panel1.Loader = new ComponentLoader();
            this.Panel1.Loader.Url = url;
            this.Panel1.Loader.Mode = LoadMode.Frame;
            this.Panel1.Loader.DisableCaching = true;
            this.Panel1.Loader.LoadMask.ShowMask = true;
            this.Panel1.Loader.LoadMask.Msg = "Loading it...";
            this.Panel1.Loader.MonitorComplete = false;
            this.Panel1.LoadContent();
        }
    
    </script>
    <!DOCTYPE html>
    <html>
    <head id="Head1" runat="server">
        <title>Ext.NET Examples</title>
        <script>
            var loadContent = function () {
                var url = "Child.aspx";
    
                App.Panel1.clearContent();
    
                X.LoadContent(url, {
                    eventMask: { showMask: false },
                    success: function () {
    
                    }
                });
            };
    
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="X" />
            <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Icon="Book" Title="Ext.Net">
                        <Loader runat="server" AutoLoad="false" />
                        <BottomBar>
                            <ext:Toolbar runat="server">
                                <Items>
                                    <ext:Button runat="server" Text="Load Content" Icon="Application">
                                        <Listeners>
                                            <Click Fn="loadContent" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </BottomBar>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] Loading Panel Content from Model
    By barnali in forum 3.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 15, 2015, 6:27 AM
  2. [CLOSED] Mask position when loading Panel's content
    By RCN in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Oct 17, 2012, 2:02 PM
  3. Tab Panel Content Loading
    By xMAC in forum 1.x Help
    Replies: 5
    Last Post: Dec 10, 2010, 7:07 AM
  4. Replies: 2
    Last Post: Mar 09, 2010, 12:55 PM
  5. Dynamic loading content page into Panel
    By wildspirit in forum 1.x Help
    Replies: 2
    Last Post: Feb 04, 2009, 5:59 PM

Tags for this Thread

Posting Permissions