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.

Question about hierarchical binding

Thread ID:

Created:

Updated:

Platform:

Replies:

127679 Dec 1,2016 07:04 PM Dec 5,2016 06:40 AM ASP.NET MVC 3
loading
Tags: Grid
R Brian Lindahl
Asked On December 1, 2016 07:04 PM

Two things, actually:

1. The documentation says to add the .QueryString property to indicate the name of the master's ID field. However, it makes no mention of setting .ForeignKey to the field name in the child datasource. I deduced that it might be necessary, but it would have been nice to see it in the docs.

2. When adding a child record, it shows up in the CrudResult handler without it's foreign key set. There isn't any mention in the "param" parameter of what that value should be. Is it maybe being passed to a property that I don't have defined? If not, how do I populate the foreign key field so that it will show up in the child grid properly (as well as satisfying the table's foreign key constraint in the database)?

Ragavee U S [Syncfusion]
Replied On December 2, 2016 07:33 AM

Hi Brian, 

Query #1: The documentation says to add the .QueryString property to indicate the name of the master's ID field. However, it makes no mention of setting .ForeignKey to the field name in the child datasource. 

We suspect that you are mentioning about the ForeignKeyField property of the Child Grid which is used when the mapping field name differs in the parent and child table. Considering this, we have created an improvement task to include the details on this property. It will be refreshed online as early as possible. 

Query #2:  how do I populate the foreign key field so that it will show up in the child grid properly 

We suggest you to define the foreign key column of the child grid to get the corresponding details while editing and saving. We can set the visible property of the corresponding column as “false” if we don’t want the column to be displayed in grid. 


Even if the visible property is set as false, the corresponding column values will be obtained in the argument when updating the record.  

Regards, 
Ragavee U S. 


R Brian Lindahl
Replied On December 2, 2016 09:27 AM

I have this:

    .ChildGrid(child =>
    {
        child
        .Datasource(ds => ds.URL("/RolesAdmin/LinksDataSource").CrudURL("/RolesAdmin/LinksCrudResult").Adaptor(AdaptorType.UrlAdaptor))
        .QueryString("Id")
        .ForeignKeyField("RoleID")
...
        .Columns(col =>
        {
            col.Field("RoleLinkID").HeaderText("ID").IsPrimaryKey(true).IsIdentity(true).Visible(false).Add();
            col.Field("RoleID").Visible(false).Add();
            col.Field("LinkName").HeaderText("Link name").Add();

however, in the CRUD handler, the RoleID property is null. I was expecting from your instructions that the parent row's "Id" field would be copied into the child grid's "RoleID" when a new record is inserted in the child grid.

Mani Sankar Durai [Syncfusion]
Replied On December 5, 2016 06:40 AM

Hi Brian, 


A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.  
 
 
 
Regards, 
Manisankar Durai. 


CONFIRMATION

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.

;