QueryString
property that has to be specified within the ChildGrid, which defines the relation between the parent and child grid. QueryString
property is used to denote the primaryKey field of the parent grid which is to be mapped with the foreignKey field of the child grid. In your code example, primary key of the parent grid is “LeagueID”. But you have passed the field name as “LeagueId” in QueryString property.
@Grid
@(Html.EJ().Grid<vwleague>("leagues")
.Datasource((IEnumerable<vwleague>)ViewBag.datasource)
.AllowGrouping()
.GroupSettings(group => { group.EnableDropAreaAnimation(false); })
.Columns(col =>
{
col.Field("LeagueID").IsPrimaryKey(true).HeaderText("ID").Width(50).Add();
. . .
})
.ChildGrid(child =>
{
child.Datasource((IEnumerable<vwteamlist>)ViewBag.datasourcechild)
.QueryString("LeagueID") //here we can pass the field which is primary key of parent field
.AllowPaging()
.Columns(col =>
{
col.Field("TeamId").Add();
})
;
});
}) |