Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Dynamically Add Tab in UltraWebTab Control
posted

Please help me, how to delete dynamically created tab in UltraWebTab.for creating tab i am using this code

 

 

 

 

 

 

 

 

 

int tabs = this

.UltraWebTab1.Tabs.Count + 1;

 

 

Tab tab = new Tab(Resources

.WebTab);

tab.Key =

 

"Key"

+ tabs.ToString();

 

 

this

.UltraWebTab1.Tabs.Add(tab);

tab.ContentPane.UserControlUrl =

 

"UserControls/CreateAlert.ascx"

;

 

 

// do not allow to jump size of UltraWebTab when UserControl is too big

tab.ContentPane.Scrollable = Infragistics.WebUI.UltraWebTab.

 

OverflowType

.Auto;

 

 

this

.UltraWebTab1.DataBind();

Please help me how to delete dynamically creatd tab...

  • 24497
    posted

    Hi Sandip,

    There are 2 methods Remove(tab) and RemoveAt(index). You may use any of them. Below is example (assume that page has 2 buttons AddTab and RemoveTab and they have corresponding handlers on click).

     protected void AddTab_Click(object sender, EventArgs e)
     {
      int count = this.UltraWebTab1.Tabs.Count;
      Infragistics.WebUI.UltraWebTab.Tab tab = new Infragistics.WebUI.UltraWebTab.Tab("Tab" + count);
      tab.Key = "TabKey" + count;
      this.UltraWebTab1.Tabs.Add(tab);
     }
     protected void RemoveTab_Click(object sender, EventArgs e)
     {
      // find tab by key and remove it
      Infragistics.WebUI.UltraWebTab.Tab tab = this.UltraWebTab1.Tabs.FromKeyTab("TabKey1");
      if(tab != null)
       this.UltraWebTab1.Tabs.Remove(tab);
      // remove tab at index
      int tabIndexToRemove = 1;
      int count = this.UltraWebTab1.Tabs.Count;
      if (count > tabIndexToRemove)
       this.UltraWebTab1.Tabs.RemoveAt(tabIndexToRemove);
     }