2013-06-06 119 views
2

我使用多視圖創建選項卡,我想要做的是關閉其中一個菜單選項卡時,我右鍵單擊它。如何在右鍵單擊時關閉/刪除菜單項或選項卡?

這些是ASPX和後面的代碼的一部分:

ASPX頁:

<asp:Menu 
    id="Menu1" 
    Orientation="Horizontal" 
    StaticMenuItemStyle-CssClass="tab" 
    StaticSelectedStyle-CssClass="selectedTab" 
    CssClass="tabs" width = "100%" 
    OnMenuItemClick="Menu1_MenuItemClick"       
    Runat="server" style=" text-align:center;"> 
</asp:Menu> 
<div id="divcont" runat="server" class="tabContents" style="height:100%; width:100%;" visible="false"> 
    <asp:MultiView 
     id="MultiView1" 
     ActiveViewIndex="0" 
     Runat="server"> 
     <asp:View ID="v1" runat="server" > 
     <iframe id="f1" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View>  
     <asp:View ID="v2" runat="server" > 
     <iframe id="f2" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v3" runat="server" > 
     <iframe id="f3" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v4" runat="server" > 
     <iframe id="f4" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v5" runat="server" > 
     <iframe id="f5" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v6" runat="server" > 
     <iframe id="f6" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View>   
     <asp:View ID="v7" runat="server" > 
     <iframe id="f7" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v8" runat="server" > 
     <iframe id="f8" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v9" runat="server" > 
     <iframe id="f9" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
     <asp:View ID="v10" runat="server" > 
     <iframe id="f10" runat="server" style="border: None; height: 100%; width: 100%;"></iframe> 
     </asp:View> 
    </asp:MultiView> 
</div> 

代碼背後:

(這是NodeChanged事件的一部分)

... 
... 
... 
int TabCount = Convert.ToInt32(lblTabCounter.Text.ToString()); 
int TabIndex = Convert.ToInt32(lblTabCounterIndex.Text.ToString()); 

if(TabCount <= 10) 
    { 
     divcont.Visible = true; 
     string tabName = getURLName(uRL); 
     MenuItem myItem = new MenuItem(tabName, TabIndex.ToString()); 
     Menu1.Items.AddAt(TabIndex, myItem); 
     f1.Attributes.Add("src", lblURL.Text.ToString()); 
     MultiView1.ActiveViewIndex = TabIndex; 
     TabCount++; 
     TabIndex++; 
     lblTabCounter.Text = TabCount.ToString(); 
     lblTabCounterIndex.Text = TabIndex.ToString(); 
     tvPermissions.ExpandAll(); 

     int i = ctr; 
    } 

(這是MenuItemClick事件)

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e) 
{ 
    int index = Int32.Parse(e.Item.Value); 
    MultiView1.ActiveViewIndex = index; 
} 

這是示例輸出:

enter image description here

樹形視圖位於橙色部分(左)。而藍色的是位於項目中的目標網址。以我提供的代碼爲基礎,僅以一個名爲「f1」的框架爲例,儘管其中有10個框架。我怎樣才能刪除特定的選項卡(比如標籤「費用」),當我右鍵點擊它?

我想要在後面的代碼中完成此操作。對於javascript/jquery解決方案,請提供代碼背後的實現或如何調用/使用它從後面的代碼。

請幫我這個。澄清請留下評論。

謝謝!

回答

0

我嘗試了不同的方法。而不是右鍵單擊我使用雙擊確認刪除選項卡。

我也調整了用戶定義的JS庫來捕捉雙擊並添加更多效果。

我也提到過,我已經有了我的JavaScript函數來處理這個問題,我只是尋找除JavaScript或JQuery以外的其他選擇。然而,我很驚訝,我沒有得到任何迴應或評論。

感謝您閱讀本文。

相關問題