http://www.telerik.com/demos/aspnet/Grid/Examples/Programming/Hierarchy/DefaultCS.aspx
and removed the Access data sources and replaced with .Net DataTables returned in a DataSet from a WebService.
The MasterTableView displays the correct rows, however when I attempt to expand a row to view the detail table the area just below the row drops down like it's trying to expand but nothing appears, just white space.
I've also tried creating 2 seperate RadGrids each displaying data from the DataTables and was successful.
Is there anything special I need to do to the DataTables before assigning them as DataSources?
Here's the code-behind (again almost exactly like the demo code except I'm using DataTables as my DataSources):
protected void Page_Load(object sender, EventArgs e)
{
RadGrid RadGrid1 = new RadGrid();
this.PlaceHolder1.Controls.Add(RadGrid1);
if (!IsPostBack)
{
DataSet ds = specTrackService.ReturnDepartures("L1");
DataTable dtShipments = ds.Tables["SRSShipments"];
DataTable dtContainers = ds.Tables["SRSContainers"];
RadGrid1.DataSource = dtShipments;
RadGrid1.MasterTableView.DataKeyNames =
new string[] { "ShipmentNumber" };
RadGrid1.Width =
Unit.Percentage(98);
RadGrid1.PageSize = 5;
RadGrid1.AllowPaging =
true;
RadGrid1.PagerStyle.Mode =
GridPagerMode.NextPrevAndNumeric;
RadGrid1.AutoGenerateColumns =
false;
RadGrid1.Skin =
"Office2007";
RadGrid1.GroupingEnabled =
true;
RadGrid1.ShowGroupPanel =
true;
RadGrid1.ClientSettings.AllowDragToGroup =
false;
RadGrid1.ClientSettings.AllowColumnsReorder =
true;
RadGrid1.MasterTableView.PageSize = 5;
RadGrid1.MasterTableView.Width =
Unit.Percentage(100);
GridBoundColumn boundColumn;
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"ShipmentNumber";
boundColumn.HeaderText =
"Shipment Number";
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"Description";
boundColumn.HeaderText =
"Description";
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"DepartureTime";
boundColumn.HeaderText =
"Departure Time";
boundColumn.ItemStyle.Width =
Unit.Pixel(125);
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"ScheduledArrivalTime";
boundColumn.HeaderText =
"Scheduled Arrival Time";
boundColumn.ItemStyle.Width =
Unit.Pixel(135);
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"ActualArrivalTime";
boundColumn.HeaderText =
"Actual Arrival Time";
boundColumn.ItemStyle.Width =
Unit.Pixel(125);
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"Status";
boundColumn.HeaderText =
"Status";
boundColumn =
new GridBoundColumn();
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField =
"SpecimenVolume";
boundColumn.HeaderText =
"Spec Volume";
//details table - Containers for a shipment
GridTableView tvContainers = new GridTableView();
RadGrid1.MasterTableView.DetailTables.Add(tvContainers);
tvContainers.DataSource = dtContainers;
tvContainers.DataKeyNames =
new string[] { "ContainerNumber" };
tvContainers.Width =
Unit.Percentage(100);
GridRelationFields relationFields = new GridRelationFields();
tvContainers.ParentTableRelation.Add(relationFields);
relationFields.MasterKeyField =
"ShipmentNumber";
relationFields.DetailKeyField =
"ShipmentNumber";
boundColumn =
new GridBoundColumn();
tvContainers.Columns.Add(boundColumn);
boundColumn.DataField =
"ContainerNumber";
boundColumn.HeaderText =
"Container Number";
boundColumn =
new GridBoundColumn();
tvContainers.Columns.Add(boundColumn);
boundColumn.DataField =
"Status";
boundColumn.HeaderText =
"Status";
}