Back to Devexpress

WebColumnBase.Visible Property

aspnet-devexpress-dot-web-dot-webcolumnbase-a0699078.md

latest4.0 KB
Original Source

WebColumnBase.Visible Property

Specifies whether the column is visible.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(true)]
public bool Visible { get; set; }
vb
<DefaultValue(True)>
Public Property Visible As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true to show the column; otherwise, false.

|

Remarks

A column’s Visible property specifies whether this column is visible. To define the column’s position among visible columns, use the VisibleIndex property.

The false value of the Visible property sets the VisibleIndex property to -1. If you change the VisibleIndex property value to non-negative, a web control sets the Visible property to true.

aspx
<dx:ASPxGridView ID="grid" runat="server" KeyFieldName="CustomerID">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="ContactName" VisibleIndex="1" />
        <dx:GridViewDataTextColumn FieldName="CompanyName" VisibleIndex="0" />
        <dx:GridViewDataTextColumn FieldName="City" VisibleIndex="3" />
        <dx:GridViewDataTextColumn FieldName="Region" Visible="false" />
        <dx:GridViewDataTextColumn FieldName="Country" VisibleIndex="2" />
    </Columns>
</dx:ASPxGridView>

The following code snippets (auto-collected from DevExpress Examples) contain references to the Visible 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.

gridview-how-to-correct-the-grouped-table-layout-if-column-widths-are-set-in-percentages-t349964/CS/Helpers/GridViewColumnHelper.cs#L64

csharp
{
    return Grid.DataColumns.Where(c => c.GroupIndex == -1 && c.Visible);
}

asp-net-web-forms-grid-get-column-values-of-multiple-selected-rows/CS/GetSelectedValuesAllColumns/Default.aspx.cs#L23

csharp
if(!IsPostBack && !IsCallback) {
    ASPxGridView1.Columns[ASPxGridView1.KeyFieldName].Visible = false;
}

asp-net-web-forms-grid-get-column-values-of-multiple-selected-rows/VB/GetSelectedValuesAllColumns/Default.aspx.vb#L25

vb
If Not IsPostBack AndAlso Not IsCallback Then
    ASPxGridView1.Columns(ASPxGridView1.KeyFieldName).Visible = False
End If

See Also

WebColumnBase Class

WebColumnBase Members

DevExpress.Web Namespace