Skip to main content
Tab

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.v24.2.dll

Declaration

public TabPage Add(
    string text,
    string name
)

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.

<form id="form1" runat="server">
    <div></div>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/nwind.mdb" 
        SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]">
    </asp:AccessDataSource>
</form>
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