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

Complex binding and how achieve that

We have a complex DTOs that is kinda like this

public class Order
{
    public int? OrderID { get; set; }
    public string CustomerID { get; set; }
    public DateTime? OrderDate { get; set; }
    public double? Freight { get; set; }
    public TestEnum? Test { get; set; }
    public List<TestClass> TestList { get; set; } = new List<TestClass>();
}

public class TestClass
{
    public int Id { get; set; }
    public double Value { get; set; }
}

public class TestId
{
    public int Id { get; set; }
    public string Name { get; set; }
    public override string ToString()
    {
        return Id.ToString();
    }
}

and we're trying to create one column for each value of TestList into Order based on a list of TestId



Everthing seems to work but, after editing the column and lost the focus, the model isn't updated with the latest information. I'll attach the example project.

Attachment: BlazorApp1_e6eb3e9a.zip

1 Reply

RS Renjith Singh Rajendran Syncfusion Team January 2, 2020 07:36 AM

Hi Pierpoalo, 

Thanks for contacting Syncfusion support. 

We would like to inform you that it is not feasible to bind a one to many relationship model  to Grid component. Grid supports only one to one relationship model. So we suggest you to bind only one to one relationship model to Grid. 

As one to many support is not available for Grid, based on your requirement we suggest you to flatten the complex property and then bind the flattened property as Field for Grid columns(instead of used template column) and perform editing on that column. 

Please get back to us if you need further assistance to flatten the complex property and bind that flattened property to Grid. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Live Chat Icon For mobile
Up arrow icon