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

Page 1 of 3 123 LastLast
  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 1:03 PM. Reason: [CLOSED]
  2. #2
    Hello,

    Please post one question per forum thread. Posting multiple questions in the same thread is VERY difficult to track properly.

    As well, please ensure your code samples are reduced to ONLY the minimum required to reproduce the problem. Please remove all code that is not directly related to the problem, such as using five Tabs, when only on one or maybe two are required.

    More information regarding post in the forums is available at the following locations:

    http://forums.ext.net/showthread.php...ing-New-Topics

    http://forums.ext.net/showthread.php...ation-Required
    Last edited by geoffrey.mcgill; Oct 22, 2013 at 8:50 AM.
    Geoffrey McGill
    Founder
  3. #3

    Script Error using open a page in Tab Panel

    Quote Originally Posted by geoffrey.mcgill View Post
    Hello,

    Please post one question per forum thread. Posting multiple questions in the same thread is VERY difficult to track properly.

    As well, please ensure your code samples are reduced to ONLY the minimum required to reproduce the problem. Please remove all code that is not directly related to the problem, such as using five Tabs, when only on one or maybe two are required.

    More information regarding post in the forums is available at the following locations:

    http://forums.ext.net/showthread.php...ing-New-Topics

    http://forums.ext.net/showthread.php...ation-Required
    Hi Geoffrey,

    I have reduced the sample code. I am getting more more errors for convert 1.x to 2.x. So that i was posted a sample which was working fine in old version.

    Ok i will post a question for each thread.
  4. #4
    Quote Originally Posted by speedstepmem4 View Post
    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?
    Please try with a Panel's Activate event. It fires each time when a tab is activating.

    Quote Originally Posted by speedstepmem4 View Post
    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.
    I think you should configure Loaders with AutoLoad="false".
  5. #5
    Quote Originally Posted by Daniil View Post
    Please try with a Panel's Activate event. It fires each time when a tab is activating.



    I think you should configure Loaders with AutoLoad="false".
    Hi,

    I have changed Activate event instead of Show event. But it comes same error. Like this, JavaScript runtime error: No URL specified ->JavaScript runtime error: 'loader1' is undefined ->JavaScript runtime error: Could not complete the operation due to error 80020101.

    Note: Tab loader url will assign in dynamically.
    see the method,
    NavigateGridPage(int CurrentTabIndex, ref Ext.Net.Panel CurrentTab){...}
    in PortalSub.aspx page.

    Please give your suggestion
    Last edited by speedstepmem4; Oct 23, 2013 at 4:01 AM.
  6. #6
    Quote Originally Posted by speedstepmem4 View Post
    Please give your suggestion
    Please post an updated code sample demonstrating exactly how you have things configured. Do not post code that unrelated to the problem.
    Geoffrey McGill
    Founder
  7. #7
    Did you set up AutoLoad="false" for Loaders?
  8. #8
    Quote Originally Posted by Daniil View Post
    Did you set up AutoLoad="false" for Loaders?
    Yes, It shows same error

    <%@ 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);
            ScriptManager1.AddScript("top.EnableTabs();");
        }
    
        protected void NavigateProcess(object sender, DirectEventArgs e)
        {
            NavigatePage(TabPanel1.ActiveTabIndex, ref Tab2);
    
            ScriptManager1.AddScript("top.EnableTabs();");
    
        }
    
    
        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);");
                        ScriptManager1.AddScript("Ext.getCmp('" + Tab2.ClientID + "').enable();");
                        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" AutoLoad="false">
                                    </Loader>
                                    <DirectEvents>
                                        <Activate OnEvent="GridNavigateProcess" ShowWarningOnFailure="false" Timeout="120000"
                                            Success="CEvent();">
                                        </Activate>
                                    </DirectEvents>
                                </ext:Panel>
                                <ext:Panel ID="Tab2" runat="server" BodyStyle="background:white">
                                    <Loader ID="loader2" runat="server" Mode="Frame" AutoLoad="false">
                                    </Loader>
                                    <DirectEvents>
                                        <Activate OnEvent="NavigateProcess" ShowWarningOnFailure="false" Timeout="120000">
                                        </Activate>
                                    </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>
        <script type="text/javascript">
    
    
            function CEvent() {
    
                if (document.getElementById('Tab1_IFrame') != null) {
                    if (document.getElementById('Tab1_IFrame').contentWindow != null) {
                        if (document.getElementById('Tab1_IFrame').contentWindow.Button1 != null)
                            document.getElementById('Tab1_IFrame').contentWindow.Button1.fireEvent("click");
                    }
    
                }
            }
    
        </script>
    </body>
    </html>
    Last edited by speedstepmem4; Oct 23, 2013 at 4:48 AM.
  9. #9
    The NavigateGridPage method. This is called:
    Tab1.LoadContent();
    when no Url is specified for the Tab1's Loader.
  10. #10
    All of your document.getElementById call should be replaced.

    document.getElementById('Tab1_IFrame').contentWindow.Button1
    You should be able to simplify to the following, which is also much more robust:

    Tab1.getBody().Button1
    Geoffrey McGill
    Founder
Page 1 of 3 123 LastLast

Similar Threads

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

Tags for this Thread

Posting Permissions