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.
Unfortunately, activation email could not send to your email. Please try again.

AddNewRow support in Master-Details View

Thread ID:





131707 Jul 24,2017 10:47 AM Aug 4,2017 01:17 AM WPF 5
Tags: SfDataGrid
Giacomo Galletto
Asked On July 24, 2017 10:47 AM


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" />

Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 27, 2017 02:56 AM

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 

Giacomo Galletto
Replied On July 27, 2017 03:48 AM

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

Jai Ganesh S [Syncfusion]
Replied On August 1, 2017 09:16 AM

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 

Giacomo Galletto
Replied On August 3, 2017 03:32 AM

Hi Jai,

thank you, now it work perfectly!



Balamurugan Rajaraman [Syncfusion]
Replied On August 4, 2017 01:17 AM

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


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.

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.