[CLOSED] Script Error using open a page in Tab Panel

Threaded View

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

    [CLOSED] Script Error using open a page in Tab Panel

    Hi,

    I have converted our 1.x application to 2.x format what you are mentioned the changes. Please below the sample pages.

    The following question/issues,
    1. In 1.x version, automatically execute Show directevent when load the tabpanel. In 2.x i will fire the event manually in Page load event (check PortalSub.aspx). How it will fire automatically or is there any other event?

    2. I have used to "Show" directevent When i show tab2 page. but it was working fine in 1.x version. Now it shows the following script error. For example,
    click Tab5 -> JavaScript runtime error: No URL specified ->JavaScript runtime error: 'loader2' is undefined ->JavaScript runtime error: Could not complete the operation due to error 80020101.

    1. Portal.aspx
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.ScriptManager1.AddScript("CallPage('1',document.getElementById('href_one'));");
            }
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ScriptManager1" runat="server" StateProvider="None" Namespace="">
        </ext:ResourceManager>
        <ext:Viewport ID="ViewPort1" runat="server" StyleSpec="background-color: transparent;"
            Layout="FitLayout">
            <Content>
                <ext:Container ID="Container1" runat="server" Layout="BorderLayout">
                    <Items>
                        <ext:Panel ID="pnlNorth" runat="server" Height="75" Border="false" Header="false"
                            BodyStyle="background-color: transparent;" Region="North">
                            <Content>
                                North section
                            </Content>
                        </ext:Panel>
                        <ext:Panel runat="server" Width="165" ID="pnlSettings" BodyStyle="background-color: #284051;"
                            Region="West">
                            <Content>
                                <ext:Container ID="Container2" runat="server" Layout="AccordionLayout">
                                    <Items>
                                        <ext:Panel ID="Panel1" runat="server" Border="false" Collapsed="True" AutoScroll="true"
                                            BodyStyle="padding:6px;">
                                            <Content>
                                                <div class="link_west">
                                                    <ul>
                                                        <li id="menu_dash" runat="server"><a href="#" id="href_one" runat="server" onclick="CallPage('1',this);">
                                                            <asp:Literal ID="lbl_dash" runat="server" Text="Dashboard"></asp:Literal></a></li>
                                                    </ul>
                                                </div>
                                            </Content>
                                        </ext:Panel>
                                    </Items>
                                </ext:Container>
                            </Content>
                        </ext:Panel>
                        <ext:TabPanel ID="tpPortal" runat="server" Border="false" BodyStyle="background-color: transparent;"
                            Region="Center">
                            <Items>
                            </Items>
                        </ext:TabPanel>
                    </Items>
                </ext:Container>
            </Content>
        </ext:Viewport>
        </form>
        <script type="text/javascript">
            var subPortalUrl = "PortalSub.aspx?module={0}";
    
            function CallPage(val, anchorObj) {
                ActiveTabValue = val;
                var modulename = "";
                if (anchorObj != null)
                    modulename = anchorObj.innerHTML;
                if (modulename != "")
                    DimensionPortal.addTab({ title: modulename, url: Ext.String.format(subPortalUrl, val), id: val });
            }
    
            var DimensionPortal = {
                hashCode: function (str) {
                    var hash = 1315423911;
    
                    for (var i = 0; i < str.length; i++) {
                        hash ^= ((hash << 5) + str.charCodeAt(i) + (hash >> 2));
                    }
    
                    return (hash & 0x7FFFFFFF);
                },
    
                addTab: function (config) {
                    if (Ext.isEmpty(config.url, false)) {
                        return;
                    }
                    var tp = Ext.getCmp('tpPortal');
                    var sid = 'id_' + this.hashCode(config.url);
                    var tab = tp.getComponent(sid);
                    if (!tab) {
                        tab = tp.addTab({
                            id: sid,
                            title: config.title,
                            closable: true,
                            loader: {
                                loadMask: {
                                    showMask: true,
                                    msg: "Loading " + config.title
                                },
                                url: config.url,
                                renderer: 'frame',
                                autoLoad: true
                            },
                            listeners: {
                                beforeShow: {
                                    fn: function (item, trigger, index, tag, e) {
    
                                    }
                                }
                            }
                        });
    
                    } else {
                        tp.setActiveTab(tab);
                        Ext.get(tab.tabEl).frame();
                    }
                }
            };
            
        </script>
    </body>
    </html>
    2. PortalSub.aspx
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["module"] != null)
                H_Txt1.Text = Request.QueryString["module"].ToString();
    
            if (!IsPostBack)
                NavigateGridPage(TabPanel1.ActiveTabIndex, ref Tab1);
        }
    
        protected void GridNavigateProcess(object sender, DirectEventArgs e)
        {
            NavigateGridPage(TabPanel1.ActiveTabIndex, ref Tab1);
    
        }
    
        protected void NavigateProcess(object sender, DirectEventArgs e)
        {
            NavigatePage(TabPanel1.ActiveTabIndex, ref Tab2);
    
        }
    
      
        private void NavigatePage(int CurrentTabIndex, ref Ext.Net.Panel CurrentTab)
        {
            TabPanel1.ActiveTabIndex = 2;
            CurrentTab.Loader.Url = "ActiveTab.aspx?tabid=2";
            CurrentTab.Loader.LoadMask.ShowMask = true;
            CurrentTab.Loader.LoadMask.Msg = "Loading";
            CurrentTab.LoadContent();
        }
    
        private void NavigateGridPage(int CurrentTabIndex, ref Ext.Net.Panel CurrentTab)
        {
            string headText = string.Empty;
            string preLoad = string.Empty;
            switch (H_Txt1.Text)
            {
    
                case "1":
                    if (preLoad != "DashBoard")
                    {
                        TabPanel1.AddScript("Ext.getCmp('Tab2').tab.show();");
    
                        Tab1.Loader.Url = "ActiveTab.aspx?tabid=1";
                        Tab1.Title = "News";
    
                        Tab2.Enabled = true;
                        Tab2.Title = "Open Workflow";
    
                        ScriptManager1.AddScript("top.window.Ext.getCmp('pnlSettings').setDisabled(true);");
                        TabPanel1.ActiveTabIndex = 0;
                        preLoad = "Dashboard";
                    }
                    break;
    
            }
            try
            {
                Tab1.Loader.LoadMask.ShowMask = true;
                Tab1.Loader.LoadMask.Msg = "Loading";
                Tab1.LoadContent();
            }
            catch (Exception ex)
            {
    
            }
        }
       
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ScriptManager1" runat="server" StateProvider="None" Namespace="">
        </ext:ResourceManager>
        <ext:Viewport ID="ViewPort1" runat="server" StyleSpec="background-color: transparent;"
            Layout="FitLayout">
            <Content>
                <ext:Container ID="Container1" runat="server" Layout="BorderLayout">
                    <Content>
                        <ext:TabPanel ID="TabPanel1" runat="server" AutoScroll="false" BodyStyle="background-color: #427298;"
                            TabPosition="top" Region="Center">
                            <Items>
                                <ext:Panel ID="Tab1" runat="server">
                                    <Loader ID="loader1" runat="server" Mode="Frame">
                                    </Loader>
                                    <DirectEvents>
                                        <Show OnEvent="GridNavigateProcess" ShowWarningOnFailure="false" Timeout="120000"
                                            Success="CEvent();">
                                        </Show>
                                    </DirectEvents>
                                </ext:Panel>
                                <ext:Panel ID="Tab2" runat="server" BodyStyle="background:white">
                                    <Loader ID="loader2" runat="server" Mode="Frame">
                                    </Loader>
                                    <DirectEvents>
                                        <Show OnEvent="NavigateProcess" ShowWarningOnFailure="false" Timeout="120000">
                                        </Show>
                                    </DirectEvents>
                                </ext:Panel>
                            </Items>
                        </ext:TabPanel>
                    </Content>
                </ext:Container>
            </Content>
        </ext:Viewport>
        <ext:TextField ID="H_Txt1" runat="server" Hidden="true">
        </ext:TextField>
        <ext:Button ID="Button1" runat="server" AutoPostBack="false" IconCls="ok" Hidden="true">
            <DirectEvents>
                <Click Delay="1" OnEvent="GridNavigateProcess" ShowWarningOnFailure="false" Timeout="1200000">
                </Click>
            </DirectEvents>
        </ext:Button>
        </form>
    </body>
    </html>
    3. ActiveTab.aspx

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write("Page Loaded in Tab " + Request.QueryString["tabid"].ToString());
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ScriptManager1" runat="server" StateProvider="None" Namespace="">
        </ext:ResourceManager>
        </form>
    </body>
    </html>
    Last edited by Daniil; Oct 29, 2013 at 2:03 PM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] Script Error using open Popup page
    By speedstepmem4 in forum 2.x Premium Help
    Replies: 11
    Last Post: Oct 07, 2013, 2:23 PM
  2. Replies: 7
    Last Post: Jun 12, 2013, 2:05 PM
  3. Replies: 3
    Last Post: Feb 26, 2013, 3:45 PM
  4. Replies: 2
    Last Post: Jul 29, 2009, 2:57 PM
  5. AutoLoad Panel Populate Child Page Error
    By camus92 in forum 1.x Help
    Replies: 5
    Last Post: Mar 09, 2009, 5:08 PM

Tags for this Thread

Posting Permissions