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
395
Adding a tab at runtime
posted

Hi,

I have an ultraWebTab on my page and during OnLoad of the page I wish to add tabs.

How do I accomplish this?

  • 24497
    Verified Answer
    posted

    Hi,

    Below is example:

    protected void Page_Load(object sender, EventArgs e)
    {
      //---------------------------------
      // tab with child controls
      string lbl1 = "new tab 1";
      Infragistics.WebUI.UltraWebTab.Tab tab1 = null;
      foreach(Infragistics.WebUI.UltraWebTab.Tab tab in this.UltraWebTab1.Tabs)
      {
       if(tab.Text == lbl1)
       {
        tab1 = tab;
        break;
       }
      }
      if(tab1 == null)
      {
       tab1 = new Infragistics.WebUI.UltraWebTab.Tab(lbl1);
       this.UltraWebTab1.Tabs.Add(tab1);
      }
      TextBox tb1 = new TextBox();
      tb1.ID = "TextBox1OnTab1";
      tab1.ContentPane.Controls.Add(tb1);
      //------------------------------
      if(!this.IsPostBack)
      {
       Infragistics.WebUI.UltraWebTab.Tab tab2 = new Infragistics.WebUI.UltraWebTab.Tab("new tab 2");
       tab2.ContentPane.TargetUrl = "http://www.msn.com";
       this.UltraWebTab1.Tabs.Add(tab2);
      }
    }