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

Declaration

public TabPage Add(
    string text,
    string name
)
Public Function Add(
    text As String,
    name As String
) As TabPage

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.

Examples

This example demonstrates how to add tab pages programmatically in code.

View Example

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