本帖最后由 xtb_sp 于 2014-9-13 18:21 编辑
就是官方demo中的示例,只是把客服端关闭事件改成服务器端关闭事件
OnClientClick="closeActiveTab();"改成
OnClick="Button2_Click",然后在后台cs页面中输出执行closeActiveTab函数
addtab.aspx
- <!DOCTYPE html>
- <html>
- <head runat="server">
- <title></title>
- <link href="../res/css/main.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <form id="form1" runat="server">
- <f:PageManager ID="PageManager1" runat="server" />
- <f:Button ID="Button1" runat="server" EnablePostBack="false" OnClientClick="openHelloFineUI();"
- Text="向父页面添加选项卡">
- </f:Button>
- <br />
- <f:Button ID="Button2" runat="server" OnClick="Button2_Click"
- Text="关闭当前选项卡">
- </f:Button>
- </form>
- <script type="text/javascript">
-
- var basePath = '<%= ResolveUrl("~/") %>';
-
- function openHelloFineUI() {
- parent.addExampleTab.apply(null, ['hello_fineui_tab', basePath + 'basic/hello.aspx', '你好 FineUI', basePath + 'res/images/filetype/vs_aspx.png', true]);
- }
- function closeActiveTab() {
- parent.removeActiveTab();
- }
- </script>
- </body>
- </html>
复制代码
addtab.aspx.cs
- protected void Button2_Click(object sender, EventArgs e)
- {
- PageContext.RegisterStartupScript("closeActiveTab();");
- }
复制代码
default.aspx页面中引入的default.js代码
- // 移除选中标签页
- window.removeActiveTab = function () {
- var activeTab = mainTabStrip.getActiveTab();
- mainTabStrip.removeTab(activeTab.id);
- };
复制代码
|