I'm trying to follow along with this demo
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx
However I want to bind the datasource of the first nested radgrid on the code behind.
I thought it might be something like this but is it more complicated than this?
RadGrid1.MasterTableView.DetailTables.radGrid2.DataSource = myDatasource;
Also another question, when I bind to this nested grid (radGrid2), I send all records and the following code will filter or do I need to grab the ID on a method call within the radGrid1? If so please direct me to how to do accomplish this?
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="referenceID" MasterKeyField="referenceID"></telerik:GridRelationFields>
</ParentTableRelation>
overview,
radGrid1 shows all records, use the dropdown and show records in the radGrid2 that pertain to that ID of radGrid1.
I foudn the following but get an error : on this line - (GridTableView)item.ChildItem.NestedTableViews[0]
Thanks
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx
However I want to bind the datasource of the first nested radgrid on the code behind.
I thought it might be something like this but is it more complicated than this?
RadGrid1.MasterTableView.DetailTables.radGrid2.DataSource = myDatasource;
Also another question, when I bind to this nested grid (radGrid2), I send all records and the following code will filter or do I need to grab the ID on a method call within the radGrid1? If so please direct me to how to do accomplish this?
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="referenceID" MasterKeyField="referenceID"></telerik:GridRelationFields>
</ParentTableRelation>
overview,
radGrid1 shows all records, use the dropdown and show records in the radGrid2 that pertain to that ID of radGrid1.
I foudn the following but get an error : on this line - (GridTableView)item.ChildItem.NestedTableViews[0]
Index was outside the bounds of the array.
protected void RadGrid1_PreRender(object sender, EventArgs e) { using (var db = new E3TDataContext()) { citationItems = db.Citations.ToList(); //RadGrid1.MasterTableView.DetailTables.radGrid2.DataSource = myDatasource; foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { GridTableView nestedView = (GridTableView)item.ChildItem.NestedTableViews[0]; if (item["parentrowColumnUniqueName"].Text == "Text") nestedView.DataSource = citationItems; else if (item["parentrowColumnUniqueName"].Text != "Text") nestedView.DataSource = citationItems; } } }Thanks