title: How to add tab page in Devexpress TabControl on button click?
body: <p>I have a <strong>Devexpress Tabcontrol</strong>. 
  Inside that Tabcontrol I am having <strong>Devexpress Grid</strong>.
  Inside that Grid I am loading <strong>button</strong> on run-time by following code.</p>
  
  <pre><code>GridViewCommandColumn col = new GridViewCommandColumn();
  GridViewCommandColumnCustomButton CusButton = new GridViewCommandColumnCustomButton();
  CusButton.ID = "btn1";
  CusButton.Image.Url = "~/Images/color.jpg";    
  col.ButtonType = ButtonType.Image;
  col.CustomButtons.Add(CusButton);
  gridview.Columns.Add(col);
  </code></pre>
  
  <p>Now on that <strong>button click</strong>, I need to add a Tab page in that Devexpress Tabcontrol retaining this Grid on first tab.</p>
  
  <p>But its not getting added, its getting refreshed on that button click</p>
  
  <p>I just created an object for <strong>Tab page</strong> and loaded <strong>Gridcontrol.ascx</strong> user control which has devexpress gridview.
  After that I just called <strong>addTabPages</strong> method in my <strong>Tabpage usercontrol</strong> and passed this <strong>Tabpage</strong> object as a parameter in it.In below code <strong>tabPreview</strong> is the object for <strong>Tabcontrol usercontrol</strong>.</p>
  
  <pre><code>tabpagenew = new TabPage();
  Gc = (GridControl)Page.LoadControl(@"GridControl.ascx");
  Gc.ID = "GC" + currDDIndex;
  ASPxGridView grdPreview = (ASPxGridView)Gc.FindControl("ggc_preview");
  grdPreview.ID = "grd" + currDDIndex;
  tabpagenew.Controls.Add(Gc);
  tabPreview.addTabPages(tabpagenew);
  </code></pre>
  
  <p>In <strong>addTabPages</strong> method, I just added Tab pages by its index,</p>
  
  <pre><code>public void addTabPages(TabPage tab_Page)
  {
      ActiveIndex = ASPxPageControl1.ActiveTabIndex + 1;
      int index = ASPxPageControl1.TabPages.Count + 1;
      ASPxPageControl1.TabPages.Add(tab_Page);
      tab_Page.ToolTip = tab_Page.Text;
      tab_Page.Name = tab_Page.Name;                
      ImageButton button = new ImageButton();
      button.ImageUrl = "~\\Images\\close.png";
      button.Style.Add(HtmlTextWriterStyle.Cursor, "Hand");
      button.Click += new ImageClickEventHandler(Close_Click);
      button.Attributes.Add("onclick", "TabClose('" + hdnCurrentTab.ClientID + "','" + tab_Page.Index + "');");              
      tab_Page.TabTemplate = new AddTabHeading(button, tab_Page.Text, ASPxPopupMenu1,  ASPxPageControl1.ActiveTabPage.VisibleIndex, ASPxPageControl1);                
  }
  </code></pre>