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

How to get focus on invalid column

I have attached simple example with 4 columns. Code currently validates 2nd column (ServerIp) when new row is created. In case of invalid valid of ServerIp (valid is hardcoded to 'aa'), focus stays on the last column of newly entered row. It does not move to invalid column of newly entered row.

Thank you for the help,
Bina Thakkar



Sync_RowValidation_c8db1093.zip

9 Replies

RC Rajadurai C Syncfusion Team February 12, 2010 01:57 PM UTC

Hi Bina,

Thanks for your interest in Syncfusion Products.

To set the focus to the 2nd column of the newly added record in the attached sample, you can handle the following code in HandleCurrentRecordContextChange method after displaying the message box.

int index = this.gridGroupingControl.Table.AddNewRecord.GetRowIndex();
this.gridGroupingControl.TableControl.CurrentCell.MoveTo(index, 2);
this.gridGroupingControl.TableControl.CurrentCell.Activate(index, 2);
this.gridGroupingControl.TableControl.CurrentCell.BeginEdit();

Here is the modified sample for your reference.
http://help.syncfusion.com/support/samples/Grid.Windows/8.1.0.30/F92846.zip

Regards,
Rajadurai


BT Bina Thakkar February 12, 2010 03:20 PM UTC

Hi:

Sample code does work and I do get focus on invalid column. But values entered in other columns get wiped off. How can I give focus to invalid column but still retain values in other columns.

Thank you,
Bina Thakkar


RC Rajadurai C Syncfusion Team February 16, 2010 02:12 PM UTC

Hi Bina,

I have checked the reported behavior with the modified sample which i provided in my last update. It works as expected. When an invalid value is entered in that column and trying to move to next record, the focus remains in that invalid column and the values entered in the other columns remains uncleared. Please check this at your side and let me know with more details, if you faces the issue.

Regards,
Rajadurai


BT Bina Thakkar February 16, 2010 04:02 PM UTC

Hi:

1) =====================================
In the new row, modify columns:
Col1 (ServerName) = "aaa"
Col2 (ServerIP) = "aaa",
Col3 (HasBeenModified) = do not change value, just take cursor in the cell.

Result:Displays an error message box. Data in all columns in new row is blank

2) =====================================
In the new row, modify columns:
Col1 (ServerName) = "aaa"
Col2 (ServerIP) = "aaa",
Col3 (HasBeenModified) = true (modify from default value)

Result:Displays an error message box. Data is present in the row. But focus is in Col3 (HasBeenModified) and not in invalid column (Col2)

Hope this helps,
Thank you for all your help,
Bina Thakkar


RC Rajadurai C Syncfusion Team February 18, 2010 03:33 PM UTC

Hi Bina,

Thanks for the steps provided. However on following this, i couldn't reproduce the behavior you reported. It works as expected. I have tested it with our latest version 8.1.0.30. Here is the video file that shows the behavior.
http://help.syncfusion.com/support/samples/Grid.Windows/8.1.0.30/F92846a.zip

Please let me know if you have any further queries regarding this.

Regards,
Rajadurai


BT Bina Thakkar February 19, 2010 04:28 PM UTC

I am using .NET 3.5 and syncfusion version 7.403.0.20. Does it mean that I need to upgrade to v8 of syncfusion?

How can I get it to work on 7.403?

Thank you,
Bnia Thakkar


RC Rajadurai C Syncfusion Team February 23, 2010 06:15 AM UTC

Hi Bina,

I could able to reproduce the behavior you reported(cells other than invalid column get cleared in addnew row) in v7.403.0.20. It has been fixed internally through related fixes. However, this can be achieved in v7.403.0.20 by handling the following code in CurrentRecordContextChange event.

if (e.Action == CurrentRecordAction.CancelEditCalled)
e.Cancel = true;

Here is the modified sample for your reference.
http://help.syncfusion.com/support/samples/Grid.Windows/7.4.0.20/F92846a.zip

Regards,
Rajadurai


BT Bina Thakkar February 23, 2010 12:34 PM UTC

Hi:
Thank you for your update.

Following scenario is still not working.

2) =====================================
In the new row, modify columns:
Col1 (ServerName) = "aaa"
Col2 (ServerIP) = "aaa",
Col3 (HasBeenModified) = true (modify from default value)

Result:Displays an error message box. Data is present in the row. But focus is in Col3 (HasBeenModified) and not in invalid column (Col2).


RC Rajadurai C Syncfusion Team February 24, 2010 05:50 PM UTC

Hi Bina,

Thanks for your update.

With the solution i provided in my previous update, the issues reproduced in both the scenarios are found to be solved. I couldn't see any issue with the scenario2 on following steps provided.

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon