Hi,
I use tabs to manage a differente pages. But I'd like close the current tab when y click on a tab page button (using javascript o c# code). Is it possible? How can I do it?
Thank you very much.
Printable View
Hi,
I use tabs to manage a differente pages. But I'd like close the current tab when y click on a tab page button (using javascript o c# code). Is it possible? How can I do it?
Thank you very much.
Hi,
You can use the following JavaScript from the Child Page.
Example
The "Panel1" is the Parent Panels .ClientID.Code:parent.Panel1.close();
Hope this helps.
The following example might help as well, see
https://examples1.ext.net/#/Panel/Ba...Communication/
Thanks, geoffrey.mcgill for your example
I tried to do it:
But tab.close() give me this error: the object does not accept this property or method.Code:var closeTab = function (id) {
var tab = PortalTabPanel.getItem(id)
if (tab) {
tab.close();
}
}
I also tried with hide method but doesn't work.
What can be the mistake?
Thank you a lot.
Hi,
Please look at the example.
Parent Page
Child PageCode:<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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 runat="server">
<title>Ext.Net Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:TabPanel ID="TabPanel1" runat="server">
<Items>
<ext:Panel ID="Panel1" runat="server" Title="Tab 1">
<AutoLoad Mode="IFrame" Url="TestIFrame.aspx">
<Params>
<ext:Parameter Name="containerID" Value="Panel1" />
</Params>
</AutoLoad>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server" Title="Tab 2">
<AutoLoad Mode="IFrame" Url="TestIFrame.aspx">
<Params>
<ext:Parameter Name="containerID" Value="Panel2" />
</Params>
</AutoLoad>
</ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>
Code:<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Hidden1.Value = this.Request["containerID"];
}
</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 runat="server">
<title>Ext.Net Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Hidden ID="Hidden1" runat="server" />
<ext:Button runat="server" Text="Close this tab">
<Listeners>
<Click Handler="parent.TabPanel1.closeTab(Hidden1.getValue());"/>
</Listeners>
</ext:Button>
</form>
</body>
</html>
This example is perfect.
Thank you very much for your help :D:
Thank you Daniil, it worked for me (:
Hi @stratek,
Thank you for the feedback!