DxGridDataColumn.ReadOnly Property
Specifies whether a user can change the column editor value when the Grid is in edit mode.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
#Declaration
[DefaultValue(false)]
[Parameter]
public bool ReadOnly { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
#Remarks
The Grid automatically generates editors for columns based on associated date types. Use the editor’s ReadOnly property to activate or deactivate the read-only mode for the editor displayed in edit form, pop-up edit form, or data rows during edit operations. If the editor property is unspecified, the column’s ReadOnly
property defines whether the editor is in read-only mode.
The ReadOnly
property does not affect the editor displayed in the filter row. To hide the filter row editor, set the column’s FilterRowEditorVisible property to false
.
The following code snippet switchs the editor in the Product ID column to the read-only mode:
@inject ProductService ProductData
<DxGrid Data="@products"
EditMode="GridEditMode.EditRow">
<Columns>
<DxGridCommandColumn />
<DxGridDataColumn FieldName="ProductID" ReadOnly="true" />
<DxGridDataColumn FieldName="ProductName" />
<DxGridDataColumn FieldName="UnitPrice" />
<DxGridDataColumn FieldName="UnitsInOrder" />
</Columns>
</DxGrid>
@code {
private Product[]? products;
protected override async Task OnInitializedAsync() {
products = await ProductData.GetData();
}
}