TabPageCollection.Add(String, String) Method
Adds a new tab page to the collection and specifies the tab page’s display text and name.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v19.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
text | String | A String value specifying the tab page’s display text. Initializes the tab page’s TabBase.Text property. |
name | String | A String value specifying the name which indentifies the created item. Initializes the tab page’s TabBase.Name property. |
Returns
Type | Description |
---|---|
TabPage | A TabPage object representing the newly created tab page. |
Remarks
Use the Add method to add a new tab page with the specified settings to the TabPageCollection object.
Example
This example demonstrates how to add tab pages programmatically in code.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/aspxpagecontrol-how-to-add-tabpages-at-runtime-e3632
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxTabControl;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.ASPxEditors;
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
ASPxPageControl pageControl = new ASPxPageControl();
pageControl.ID = "pageControl";
Form.Controls.Add(pageControl);
pageControl.TabPages.Add("Page 1", "Page 1");
pageControl.TabPages.Add("Page 2", "Page 2");
ASPxGridView grid = new ASPxGridView();
grid.ID = "grid";
pageControl.TabPages[0].Controls.Add(grid);
grid.DataSource = AccessDataSource1;
grid.DataBind();
ASPxTextBox txt = new ASPxTextBox();
txt.ID = "txt";
txt.Text = "myTextBox";
pageControl.TabPages[1].Controls.Add(txt);
}
}
See Also