IsAddNewIndex is always false in MasterDetailsView rowValidating

Hello,

When I add a new row in nested grid in RowValidating method IsAddNewIndex is always false.

 private void FirstLevelNestedGrid2_RowValidating(object sender, RowValidatingEventArgs e)

        {

            if (FirstLevelNestedGrid2.IsAddNewIndex(e.RowIndex))

            {

                e.IsValid = false;

            }

        }


Attachment: SyncfusionWpfApp4_20d9db81.rar

1 Reply 1 reply marked as answer

VS Vijayarasan Sivanandham Syncfusion Team August 10, 2021 02:56 PM UTC

Hi Theofilos,

Thank you for contacting Syncfusion Support.

In SfDataGrid each of child contains DataGrid. Please refer the below screen shot,


Your requirement can be achieved by checking the AddNewRowIndex based on SelectedDetailsViewGrid of SfDataGrid. Please refer the below code snippet, 
private void FirstLevelNestedGrid2_RowValidating(object sender, RowValidatingEventArgs e) 
{ 
            //check the AddNewRowIndex for SelectedDetailsViewGrid in SfDataGrid 
            if (dataGrid.SelectedDetailsViewGrid.IsAddNewIndex(e.RowIndex)) 
            { 
                e.IsValid = false; 
            } 
} 
For more information related to Master Details View, please refer the below user guide documentation,

UG Link: https://help.syncfusion.com/wpf/datagrid/master-details-view

Please let us know if you have any concerns in this.

Regards,
Vijayarasan S 


Marked as answer
Loader.
Up arrow icon