title: How to close/remove menu item or tab when right click?
body: <p>I'm creating tab using multiview and what I want to do is to close one of the menu tabs when I right click on it.</p>
  
  <p>These are part of the aspx and code behind:</p>
  
  <p>ASPX Page:</p>
  
  <pre><code>&lt;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;"&gt;
  &lt;/asp:Menu&gt;
  &lt;div id="divcont" runat="server" class="tabContents" style="height:100%; width:100%;" visible="false"&gt;
      &lt;asp:MultiView
          id="MultiView1"
          ActiveViewIndex="0"
          Runat="server"&gt;
          &lt;asp:View ID="v1" runat="server" &gt;
          &lt;iframe id="f1" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;      
          &lt;asp:View ID="v2" runat="server" &gt;
          &lt;iframe id="f2" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v3" runat="server" &gt;
          &lt;iframe id="f3" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v4" runat="server" &gt;
          &lt;iframe id="f4" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v5" runat="server" &gt;
          &lt;iframe id="f5" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v6" runat="server" &gt;
          &lt;iframe id="f6" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;        
          &lt;asp:View ID="v7" runat="server" &gt;
          &lt;iframe id="f7" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v8" runat="server" &gt;
          &lt;iframe id="f8" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v9" runat="server" &gt;
          &lt;iframe id="f9" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
          &lt;asp:View ID="v10" runat="server" &gt;
          &lt;iframe id="f10" runat="server" style="border: None; height: 100%; width: 100%;"&gt;&lt;/iframe&gt;
          &lt;/asp:View&gt;
      &lt;/asp:MultiView&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <p>(This is part of the NodeChanged event)</p>
  
  <pre><code>...
  ...
  ...
  int TabCount = Convert.ToInt32(lblTabCounter.Text.ToString());
  int TabIndex = Convert.ToInt32(lblTabCounterIndex.Text.ToString());
  
  if(TabCount &lt;= 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;
      }
  </code></pre>
  
  <p>(This is for the MenuItemClick Event)</p>
  
  <pre><code>protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
  {
      int index = Int32.Parse(e.Item.Value);
      MultiView1.ActiveViewIndex = index; 
  }
  </code></pre>
  
  <p>This is the sample output:</p>
  
  <p><img src="https://i.stack.imgur.com/UV9DK.png" alt="enter image description here"></p>
  
  <p>The treeview is located in the orange part(left). While the blue one that is the target url that is located in the project. Based from the codes that I provided it will only point out to one frame named "f1" as an example though there are 10 of them. How can I remove a particular tab (say tab "Expenses") when I right click on it?</p>
  
  <p>I want this to be done in the code behind. For javascript/jquery solutions please provide its code behind implementation or how to call/use it from code behind.</p>
  
  <p>Please help me with this. For clarifications please leave a comment.</p>
  
  <p>Thank you!</p>