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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Child Grid with CRUD & Dropdown

Thread ID:

Created:

Updated:

Platform:

Replies:

143926 Apr 10,2019 06:29 PM UTC Jul 28,2020 05:16 AM UTC ASP.NET Core - EJ 2 5
loading
Tags: DataGrid
Yoab Youssoufou
Asked On April 10, 2019 06:29 PM UTC

hello,
using the childgrid field of new HierarchyGrids in ej2 how can I implement CRUD in the childgrid? also what if i have a dropdownlist as one of the fields in the child grid, how is this done?
In parent Grid, foreign keys are handled like so:  
headertext="Produce Group" 
foreignkeyfield="Id" 
allowediting="true" 
foreignkeyvalue="Name" 
width="165" 
  datasource="@gen.GetLkProduceGroups()">


How can I do this in the Child Grid.

Thanks

Thavasianand Sankaranarayanan [Syncfusion]
Replied On April 11, 2019 01:40 PM UTC

Hi Yoab, 

Greetings from Syncfusion support. 

Based on your query we suspect that you want to know how to enable CRUD configuration for child Grid and set foreignKey column for child Grid. There is no difference to set foreignKey column and enable CRUD operation with child Grid as you given in normal. 

Refer the help documentation. 



Please let us know if you need further assistance on this.  

Regards, 
Thavasianand S. 


Yoab Youssoufou
Replied On April 11, 2019 01:46 PM UTC

Hello I'm afraid you didn't quite understand me. I am talking about the childgrid using the new specification in the master grid(childGrid="ChildGrid1")
the childgrid is then specified as something like:

@{

    var ChildGrid1 = new Syncfusion.EJ2.Grids.Grid()
    {
        DataSource = @pb.GetAll(),
        QueryString = "PayeesId",

        Columns = new List<Syncfusion.EJ2.Grids.GridColumn> {
        new Syncfusion.EJ2.Grids.GridColumn(){ Field="BanksId", HeaderText="Bank", Width="200" },
        new Syncfusion.EJ2.Grids.GridColumn(){ Field="AccountNo", HeaderText="Account No.", Width="70", TextAlign=Syncfusion.EJ2.Grids.TextAlign.Right }

}

    };


    };

In this case foreign key in the above child grid cannot be specified as in the mastergrid neither can the CRUD

Thavasianand Sankaranarayanan [Syncfusion]
Replied On April 12, 2019 11:28 AM UTC

Hi Yoab, 

Thanks for your clarification. 

As per your suggestion we have created a sample with foreign key column and editing feature in child Grid. Please refer the below code example and sample for more information. 

 
@{ 
            var ChildGrid1 = new Syncfusion.EJ2.Grids.Grid() 
            { 
                DataSource = ViewBag.empData, 
                QueryString = "EmployeeID", 
                EditSettings = new Syncfusion.EJ2.Grids.GridEditSettings() { AllowAdding = true, AllowEditing = true, AllowDeleting = true }, 
                Toolbar = new List<string>() { "Add", "Edit", "Delete", "Update", "Delete" }, 
                Aggregates = new List<Syncfusion.EJ2.Grids.GridAggregate> { 
            new Syncfusion.EJ2.Grids.GridAggregate() {Columns =col} }, 
                Columns = new List<Syncfusion.EJ2.Grids.GridColumn> { 
new Syncfusion.EJ2.Grids.GridColumn(){ Field="orderid", HeaderText="ID", IsPrimaryKey=true, Width="200" }, 
new Syncfusion.EJ2.Grids.GridColumn(){ Field="id", ForeignKeyField="EmployeeID1", ForeignKeyValue="FullName", DataSource= ViewBag.empData1, HeaderText="Full Name", Width="200" }, 
} 
 
            }; 
        } 
 
============================================= 
 
<ejs-grid id="PublishedGrid" dataSource="ViewBag.data" childGrid="ChildGrid1" allowPaging="true" gridLines="Both"> 
    <e-grid-pagesettings pageSize="10"></e-grid-pagesettings> 
    <e-grid-editSettings allowAdding="false" allowDeleting="false" allowEditing="false" showDeleteConfirmDialog="true" showConfirmDialog="true"></e-grid-editSettings> 
    <e-grid-textwrapsettings wrapMode="Both"></e-grid-textwrapsettings> 
 
    <e-grid-columns> 
        <e-grid-column field="OrderID" isIdentity="true" isPrimaryKey="true" width="180" textAlign="Right" visible="true"></e-grid-column> 
        <e-grid-column field="EmployeeID" headertext="HReadable" width="150"></e-grid-column> 
    </e-grid-columns> 
</ejs-grid> 


Regards, 
Thavasianand S. 


Yoab Youssoufou
Replied On July 27, 2020 02:20 PM UTC

Thanks so much, sorry for the delay I thought I had replied you. It's perfect

Balaji Sekar [Syncfusion]
Replied On July 28, 2020 05:16 AM UTC

Hi Yoab, 
 
We glad that your issue has been fixed.  
  
Please get back to us if you require further other assistance from us. 
 
Regards, 
Balaji Sekar

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon