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
close icon

How to set focus in current cell when specific validation fail in gridgrouping control of syncfusion

Hi,
I am using Gridgrouping control.
I have Parent-Child Relationship in the control.
I want to change values in cell of  rows values in child table.
for that TableControlCurrentCellEditingComplete is fired 

when i change the value in current cell following validation gives in TableControlCurrentCellEditingComplete enent 
If (Curretqty > chkRetQty) Then
                        MessageBox.Show("Sales Return Quantity Should be Less Than Availabel Return Quantity + Existing Return Quantity")
                        e.TableControl.Model(RowIndex, 10).Text = 0
                    End If

When above condition is fail i want set the focus in current cell

Thank you and Regards,
Supriya

1 Reply

NK Neelakandan Kannan Syncfusion Team January 19, 2015 08:34 AM UTC

Hi Supriya,

 

Thank you for your interest in Syncfusion products.

 

If you want to set the CurrentCell focus based on your needed validation, you can use MoveTo method to set the CurrentCell position. Using that method, you can provide your needed RowIndex and ColumnIndex and you can set current cell activation property to SetFocus. Please make use of below code and please find the attached sample,

 

Code Snippet:

Private Sub gridGroupingControl1_TableControlCurrentCellEditingComplete(ByVal sender As ObjectByVal As GridTableControlEventArgs)
        
If (e.TableControl.TableDescriptor.Columns((e.TableControl.CurrentCell.ColIndex - 2)).Name "parentID"Then
            If 
(Integer.Parse(e.TableControl.Model(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex).Text) 10Then
                
e.TableControl.Model(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex).Text "0"
                
e.TableControl.CurrentCell.MoveTo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex, GridSetCurrentCellOptions.SetFocus)
                MessageBox.Show(
"The ParentID column value should be less than 10")
            
End If
        End If
    End Sub

 

Note:

In the below sample, if you change the value in parentID column(greater than 10), the message box will be shown and then immediately CurrentCell will be focused.

 

Please let me know if you have any concerns.

 

Regards,

Neelakandan


Attachment: Sample_CurrentCell_SetFocus_VB_e0fd22ef.zip

Loader.
Live Chat Icon For mobile
Up arrow icon