程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> Ext.Net.Panel的Loader屬性實現引用頁面。

Ext.Net.Panel的Loader屬性實現引用頁面。

編輯:C#入門知識

Panel通過Loader方式,調用頁面作為內容加載。
其中,要注意的幾個關鍵點:

主頁面:

<ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <ext:Panel ID="Panel1" runat="server" Title="Parent" Height="300" Width="500">
        <Items>
            <ext:Button ID="Button1" runat="server" Text="Button1" OnDirectClick="btn1_Click">
            </ext:Button>
         
        </Items>
        <Loader ID="Loader1" runat="server" Url="Child.aspx" Mode="Html" Scripts="true" />
        <Buttons>
            <ext:Button ID="Button2" runat="server" Text="Button2" OnDirectClick="btn2_Click" />
        </Buttons>
    </ext:Panel>

 後台代碼:

protected void btn2_Click(object sender, DirectEventArgs e)
        {
          
            Panel1.Loader.Visible = false;
            Panel1.Update();
        }

        protected void btn1_Click(object sender, DirectEventArgs e)
        {
            Panel1.Loader.Visible = true;
            Panel1.Update();
        }

 子頁面:

<ext:ResourceManager ID="ResourceManager1" runat="server" RenderScripts="None">
    </ext:ResourceManager>
    <ext:Panel ID="Panel2" runat="server" Title="Child" Width="300" Height="185" Frame="true">
        <Items>
            <ext:Label ID="Label2" runat="server" />
        </Items>
        <Buttons>
            <ext:Button ID="btnChild" runat="server" Text="Submit [DirectEvent]">
                <DirectEvents>
                    <Click OnEvent="btnChild_Click" Url="Child.aspx" />
                </DirectEvents>
            </ext:Button>
            <ext:Button ID="Button1" IDMode="Ignore" runat="server" Text="Submit [DirectMethod]">
                <Listeners>
                    <Click Handler="App.direct.ButtonClickChild({ url: 'Child.aspx' });" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Panel>

 後台代碼:

 protected void btnChild_Click(object sender, DirectEventArgs e)
        {
            this.Label2.Text = "Child [DirectEvent]: " + DateTime.Now.ToLongTimeString();
            X.Msg.Alert("DirectEvent", "Child Button Clicked").Show();
        }

        [DirectMethod]
        public void ButtonClickChild()
        {
            this.Label2.Text = "Child [DirectMethod]: " + DateTime.Now.ToLongTimeString();
            X.Msg.Alert("DirectMethod", "Child Button Clicked").Show();
        }

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved