We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Focus is not changed from an Enabled cell.

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

2 Replies

AD Administrator Syncfusion Team November 18, 2002 07:08 PM

> 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


TL Tom Le Blanc November 19, 2002 09:50 AM

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

Loader.
Live Chat Icon For mobile
Up arrow icon