DxGrid.GetDataColumns() Method
Returns a data column collection.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public IReadOnlyList<IGridDataColumn> GetDataColumns()
Returns
Type | Description |
---|---|
IReadOnlyList<IGridDataColumn> | The data column collection. |
Remarks
Call the GetDataColumns
method to get a collection of data columns declared in the Grid’s markup. To obtain a collection of all Grid columns, call the GetColumns() method.
@using Grid.Data
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data" @ref="@MyGrid"
ShowFilterRow="true"
@bind-SelectedDataItems="@SelectedDataItems">
<Columns>
<DxGridSelectionColumn />
<DxGridDataColumn FieldName="TemperatureC" />
<DxGridDataColumn FieldName="TemperatureF" />
<DxGridDataColumn FieldName="Date" DisplayFormat="D" />
<DxGridDataColumn FieldName="Forecast" />
<DxGridDataColumn FieldName="CloudCover" />
</Columns>
</DxGrid>
<DxButton Click="@OnGetDataColumns">Get Data Columns</DxButton>
<p />
<div><b>Data Columns</b>: @ColumnInfo</div>
@code {
IGrid MyGrid { get; set; }
object Data { get; set; }
string ColumnInfo { get; set; }
IReadOnlyList<object> SelectedDataItems { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
void OnGetDataColumns() {
var columns = MyGrid.GetDataColumns().Select(
(column) => (column as IGridDataColumn).FieldName
);
ColumnInfo = string.Join("; ", columns);
}
}
Implements
See Also