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

AddNewRow support in Master-Details View


I am trying to achieve the porpuse of adding new details row in a SfDataGrid in Master-Details View, without success.
I am following this guidelines but I can't see any changes on my grid.

Below the xaml code I tried, using auto-generated columns and also non auto-generated columns.
AutoGenerateRelations is set to False on SfDataGrid

         <syncfusion:GridViewDefinition RelationalColumn="Emails">
                        <syncfusion:SfDataGrid x:Name="FirstLevelNestedGrid" AddNewRowPosition="Top" AutoGenerateColumns="True"/>
                        <!--<syncfusion:SfDataGrid x:Name="FirstLevelNestedGrid" AddNewRowPosition="Top" AutoGenerateColumns="False">
                                <syncfusion:GridTextColumn HeaderText="IdEmail" MappingName="Id" IsHidden="True" />
                                <syncfusion:GridTextColumn HeaderText="IdAnagrafica" MappingName="IdAnagrafica" IsHidden="True" />
                                <syncfusion:GridTextColumn HeaderText="Nome" MappingName="OwnerName" />
                                <syncfusion:GridTextColumn HeaderText="Email" MappingName="Address" />

5 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team July 27, 2017 06:56 AM UTC

Hi Giacomo, 
Thank you for contacting Syncfusion support. 
We have checked your query. We are unable to reproduce reported issue “AddNewRow in Master-Details views are not working” in our end. For your reference, we have attached video and sample in below location. In that sample, we have added AddNewRow in master-detailsview dataGrid, the entered addnewrow value are insert properly in grid. Could you please refer to it. 
Note: The underlying data object must be defined with default constructor. Otherwise, create instance of data object by handling AddNewRowInitiating event. 
If you are still facing the issue, could you please revert by modifying sample based on your application and also could you please conform your essential studio version ?. This would be helpful for us to provide an appropriate solution.  
Muthukumar K 

UN Unknown Syncfusion Team July 27, 2017 07:48 AM UTC

Hi Muthukumar,

thank you for your very detailed reply, but what you showed in the video and in the demo project you sent me was already in place for me: I am able to add new details row, but only if there already is at least a details row.

My difficulty is to add a new details row relative to a brand new master row: this seems to be not possible even in your demo project.

I attached a video where I'm using your demo project, adding a new master row and then trying to add a details row to it: you'll see there is only the header row in the details grid, no "Add new row" entry.

I'm a total rookie with Syncfusion Essential Studio since I am starting to use it after purchasing the license so apologies if there is something obvious I am missing.



Attachment: SfDataGrid_AddNewRow_MasterDetails_ReplyTo_1_4f83e89d.zip

JG Jai Ganesh S Syncfusion Team August 1, 2017 01:16 PM UTC

Hi Giacomo, 
You can achieve your requirement for adding a new row for newly added detailsview by wiring the AddNewRowInitiating event and creating an instance of detailsview like below, 
this.dataGrid.AddNewRowInitiating += DataGrid_AddNewRowInitiating; 
private void DataGrid_AddNewRowInitiating(object sender, Syncfusion.UI.Xaml.Grid.AddNewRowInitiatingEventArgs e) 
    (e.NewObject as OrderInfo).OrderDetails = new ObservableCollection<OrderDetails>(); 
Jai Ganesh S 

UN Unknown Syncfusion Team August 3, 2017 07:32 AM UTC

Hi Jai,

thank you, now it work perfectly!



BR Balamurugan Rajaraman Syncfusion Team August 4, 2017 05:17 AM UTC

Hi Giacomo 
Thanks for the update. 
Please let us know, if you need any further assistance on  this. 
Balamurugan R 

Live Chat Icon For mobile
Up arrow icon