[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
Code:
<%@ 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
Code:
<%@ 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
Code:
<%@ 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>
Script Error using open a page in Tab Panel
Quote:
Originally Posted by
geoffrey.mcgill
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.