Articles in this section
Category / Section

How to restrict the editing of specific cells in WinForms GridGroupingControl?

1 min read

Restrict the editing of specific cell

In WinForms GridGroupingControl, to restrict the cells from editing only in specific scenarios like using dynamic filter with expressions (GridDynamicFilter), make use of the QueryCellStyleInfo event and validate the condition that ReadOnly property should be false only if it is FilterBar CellType.

C#

void hierarchyGrid_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
     //stop user from editing the contents of the grid cell
     e.Style.ReadOnly = (e.TableCellIdentity.TableCellType == GridTableCellType.FilterBarCell)? false : true; 
}

VB

Private Sub hierarchyGrid_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
     'stop user from editing the contents of the grid cell
     e.Style.ReadOnly = If((e.TableCellIdentity.TableCellType = GridTableCellType.FilterBarCell), False, True)
End Sub

 

Screenshots

Restrict the editing for all cells except filter cell in WinForms GridGroupingControl

 

Search the font style in WinForms GridGroupingControl

 

Samples:

C#: Readonlycells_CS

VB: Readonlycells_VB

Conclusion

I hope you enjoyed learning about how to restrict the editing of specific cells in WinForms GridGroupingControl.

You can refer to our WinForms GridGroupingControl’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our Winforms GridGroupingControl and other WinForms components.

If you have any queries or require clarifications, please let us know in the comment section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please sign in to leave a comment
Access denied
Access denied