Intersoft Support Center

Add/Close Tab in Client-side

You can add and close new tab items programmatically at client side.

This topic will show you how to add/close tab in client side.

To add/close tab in client-side

  1. Drag 2 HTML buttons from the toolbox.
  2. Create AddNewTab() function to implement adding new tab.
    JavaScript Copy Code
    var tabNewIndex = 0;
    function AddNewTab()
       var tab = ISGetObject("WebTab1");
       var newItem = tab.AddNewTabItem("WebTab" + tabNewIndex, "WebTab " + tabNewIndex, null);
       var activeTab = newItem;
       activeTab.ContentMode = "UseInlineContent";
       newItem.SetActive(); // set the newly created tab item as active     

  3. Create CloseTab() function to implement closing tab items.
    JavaScript Copy Code
    function CloseTab()
       var tab = ISGetObject("WebTab1");
       var tabItem = tab.GetActiveTab();

  4. Invoke AddNewTab() and CloseTab() using html button onclick event.

    <input id="Button1" type="button" value="button" onclick="AddNewTab()" />

    <input id="Button2" type="button" value="button" onclick="CloseTab()" />

  5. Run the project.
Previous Next