@{
var col = new List<Syncfusion.EJ2.Grids.GridAggregateColumn> {
new Syncfusion.EJ2.Grids.GridAggregateColumn(){ Field = "FirstName", Format = "C2", Type = "count", FooterTemplate = "Count: ${count}" }
};
}
@{
var ChildGrid1 = new Syncfusion.EJ2.Grids.Grid()
{
DataSource = ViewBag.empData,
QueryString = "EmployeeID",
Aggregates = new List<Syncfusion.EJ2.Grids.GridAggregate> {
new Syncfusion.EJ2.Grids.GridAggregate() {Columns =col} },
. . .
};
}
=============================================
<ejs-grid id="PublishedGrid" dataSource="ViewBag.data" childGrid="ChildGrid1" allowPaging="true" gridLines="Both">
<e-grid-columns>
<e-grid-column field="OrderID" isIdentity="true" isPrimaryKey="true" width="80" textAlign="Right" visible="true"></e-grid-column>
. . .
</e-grid-columns>
</ejs-grid> |
@{
var ChildGrid1 = new Syncfusion.EJ2.Grids.Grid()
{
DataSource = ViewBag.empData,
QueryString = "EmployeeID",
Columns = new List<Syncfusion.EJ2.Grids.GridColumn> {
new Syncfusion.EJ2.Grids.GridColumn(){ Field="FirstName", HeaderText="Produce", Width="200" },
new Syncfusion.EJ2.Grids.GridColumn(){ Field="EmployeeID", Template="<a rel='nofollow' rel='nofollow' href='Home/Participate/?Id=${EmployeeID}' class='modal-link btn-xs btn-success'>Participate</a>", HeaderText="Quantity", Width="70", Format="N0" }
} . . .
};
}
=============================================
<ejs-grid id="PublishedGrid" dataSource="ViewBag.data" childGrid="ChildGrid1" allowPaging="true" gridLines="Both">
<e-grid-columns>
<e-grid-column field="OrderID" isIdentity="true" isPrimaryKey="true" width="80" textAlign="Right" visible="true"></e-grid-column>
. . .
</e-grid-columns>
</ejs-grid> |
@{
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> |
how about two child grids?
not
Hi Aaron,
Greetings from Syncfusion support.
By default, inEJ2 Grid, you cannot have two childgrids of the same level. We suggest you to use the detail template where you can have custom number of grids in the same level. Please refer the below demo sample and documentaiton for more details on detail template.
Sample: https://ej2.syncfusion.com/aspnetcore/Grid/DetailTemplate#/bootstrap5
Documentation: https://ej2.syncfusion.com/aspnetcore/documentation/grid/row/detail-template
Regards,
Joseph I.