The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a column that has been disabled with:
grid1.Model.ColStyles(1).Enabled = False
If a user selects one of the enabled cells to edit information then clicks on one of the cells in the disabled column that cell then appears to be selected (but readonly) but the enabled cell remains in focus with the caret active in the cell awaiting orders.
Is this by design? Is there someway to remove focus from the enabled cell eventhough the newly selected cell is diabled?
Thanks,
Tom
ADAdministrator Syncfusion Team November 19, 2002 12:08 AM UTC
> I have a column that has been disabled with:
> grid1.Model.ColStyles(1).Enabled = False
>
> If a user selects one of the enabled cells to edit information then clicks on one of the cells in the disabled column that cell then appears to be selected (but readonly) but the enabled cell remains in focus with the caret active in the cell awaiting orders.
>
> Is this by design? Is there someway to remove focus from the enabled cell eventhough the newly selected cell is diabled?
>
> Thanks,
> Tom
>
This behavior is by design. If you click on some disabled control, the current focus does not change. The grid mimics this behavior.
If you want to stop the editing when you click a disabled cell, then you could try handling the click event, and calling CurrentCell.EndEditing.
Private Sub GridDataBoundGrid1_CellClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs) Handles GridDataBoundGrid1.CellClick
Console.WriteLine("GridDataBoundGrid1_CellClick")
If Me.GridDataBoundGrid1(e.RowIndex, e.ColIndex).Enabled = False Then
Me.GridDataBoundGrid1.CurrentCell.EndEdit()
End If
End Sub
TLTom Le BlancNovember 19, 2002 02:50 PM UTC
Thanks Clay,
That didn't quite work but it pointed me in the right direction. I added this after the EndEdit command:
GridControl1.CurrentCell.Deactivate(False)
The Deactivate method did the trick. It removed the focus from the editable cell. [The "False" retains edits the user made in the cell.]
Tom