[CLOSED] Panel fires postbacks on expand/collapse

  1. #1

    [CLOSED] Panel fires postbacks on expand/collapse

    Hi,

    Is there any way to prevent a Panel from firing auto PostBacks on Expand and Collapse client events?
    Last edited by Daniil; Oct 21, 2014 at 6:25 AM. Reason: [CLOSED]
  2. #2
    There are no components within Ext.NET that fire PostBack events, by default.

    Can you provide a sample which reproduces the scenario?
    Geoffrey McGill
    Founder
  3. #3
    I've replaced the Expand and Collapse event handlers with BeforeExpand and BeforeCollapse, respectively, and no postback is fired anymore on either. This behavior is pretty strange in my opinion. I will try to put together a stripped down code sample to reproduce the issue.
  4. #4
    Please refer to the code snippet below. Click on the button to load the panel initially. It will fire a postback on either Expand or Collapse client event thereafter.

    Main.aspx
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        [DirectMethod]
        public void LoadPreview(string url)
        {
            this.PanelPreview.ClearContent();
            this.PanelPreview.RemoveAll(true);
            this.PanelPreview.AutoLoad.Url = url;
            this.PanelPreview.AutoLoad.Mode = LoadMode.IFrame;
            this.PanelPreview.AutoLoad.NoCache = true;
            this.PanelPreview.AutoLoad.ShowMask = true;
            this.PanelPreview.AutoLoad.MaskMsg = "Loading Preview...";
            this.PanelPreview.LoadContent();
        }
    </script>
    <!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 id="Head1" runat="server">
        <title>Ext.NET Example</title>
        <script type="text/javascript">
            var onClick = function () {
                PanelPreview.clearContent();
                var url = "Preview.aspx";
    
                X.LoadPreview(url, {
                    eventMask: { showMask: false },
                    success: function () {
                        PanelPreview.expand(false);
                    }
                });
            };
    
            var onCollapse = function () {
    
            };
    
            var onExpand = function () {
    
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" DirectMethodNamespace="X" />
            <ext:Viewport runat="server" Layout="BorderLayout">
                <Items>
                    <ext:Panel runat="server" Region="Center">
                        <Items>
                            <ext:Button runat="server" Text="Load & Preview">
                                <Listeners>
                                    <Click Fn="onClick" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="PanelPreview" runat="server" Region="East" HideMode="Offsets" Collapsed="true" CollapseMode="Mini" Width="800"
                        Collapsible="true" Title="Preview (Read-only)">
                        <Listeners>
                            <Collapse Fn="onCollapse" />
                            <Expand Fn="onExpand" />
                        </Listeners>
                    </ext:Panel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    Preview.aspx
    <%@ Page Language="C#" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(DateTime.Now.ToString("HH:mm:ss tt"));
        }
    </script>
  5. #5
    Hi Vadym,

    A browser reloads an iframe if it is moved in the DOM hierarchy. This issue is not related to Ext.NET, it is what a browser does.

    There is a lot of similar requests on the internet. For example,
    http://stackoverflow.com/questions/8...sing-its-state

    With your test case the issue is reproducible, because collapse/expand is animated by default. Animation moves the element in the DOM hierarchy.

    So, the only solution is to turn off the animation for the PanelPreview by setting this:
    AnimCollapse="false"
  6. #6
    Thanks for the great insight, Daniil! It was one of those little pesky things that would throw a monkey wrench into our UI design. Glad it's out of the way. Please mark this thread as closed.

Similar Threads

  1. [OPEN] [#503] Expand/Collapse Panel
    By snow_cap in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Jul 11, 2014, 12:38 PM
  2. [CLOSED] Panel/Container No Expand()/Collapse() api?
    By michaeld in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 22, 2013, 1:52 AM
  3. Replies: 0
    Last Post: Nov 03, 2012, 7:19 AM
  4. [CLOSED] Expand/Collapse of IFrame Panel
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 16, 2012, 7:47 AM
  5. [CLOSED] Panel: How to hide the Collapse/Expand (+ and -) button?
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 21, 2011, 2:45 AM

Tags for this Thread

Posting Permissions