Back to Devexpress

GridViewCommandColumn.ShowNewButton Property

aspnet-devexpress-dot-web-dot-gridviewcommandcolumn-97a9fcb7.md

latest3.9 KB
Original Source

GridViewCommandColumn.ShowNewButton Property

Specifies whether the New command button is displayed in the command column.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(false)]
public bool ShowNewButton { get; set; }
vb
<DefaultValue(False)>
Public Property ShowNewButton As Boolean

Property Value

TypeDefaultDescription
Booleanfalse

true, if the button is visible; otherwise, false.

|

Remarks

Use the ShowNewButton property to specify whether the New button is visible in the command column. To display the button in the command column header, set the GridViewCommandColumn.ShowNewButtonInHeader property to true. The button settings can be customized using the ASPxGridViewCommandButtonSettings.NewButton property.

Note

Specify the ASPxGridBase.KeyFieldName property when you add a new and delete an existing grid row.

In markup:

aspx
<dx:ASPxGridView ID="ASPxGridView1" runat="server" >
    <Columns>  
        <dx:GridViewCommandColumn ShowNewButton="True" />  
        ...
    </Columns>  
</dx:ASPxGridView>

In code:

csharp
using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e) {
    ASPxGridView grid1 = new ASPxGridView();
    grid1.ID = "grid1";
    Page.Form.Controls.Add(grid1);
    ...
    GridViewCommandColumn commandColumn = new GridViewCommandColumn();
    commandColumn.ShowNewButton = true;
    grid1.Columns.Add(commandColumn);
    ...
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowNewButton property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/CS/MasterDetailGrids/Default.aspx.cs#L166

csharp
colCmd.ShowEditButton = true;
colCmd.ShowNewButton = true;
colCmd.ShowDeleteButton = true;

asp-net-web-forms-grid-create-master-detail-grid-at-runtime/VB/MasterDetailGrids/Default.aspx.vb#L170

vb
colCmd.ShowEditButton = True
colCmd.ShowNewButton = True
colCmd.ShowDeleteButton = True

See Also

Grid View

GridViewCommandColumn Class

GridViewCommandColumn Members

DevExpress.Web Namespace