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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

117982 Jan 16,2015 05:58 AM UTC Jan 19,2015 08:34 AM UTC WinForms 1
loading
Tags: GridGroupingControl
Supriya Varne
Asked On January 16, 2015 05:58 AM UTC

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

Neelakandan Kannan [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;