Hi Raja,
Did you ever get this issue resolved? If so, how?. I am also facing the same issue with the child grid behaviours. cannot get paging/filtering to work
Hi,
Hi Alexander
I am also facing same problem I have a grid and binding data upto 2 levels with dataset now on click on expand row no other data is not coming error: - Runtime Exception: No child grid script descriptors are available.
<ig:WebHierarchicalDataGrid ID="grdDetails" StyleSetName="Default" runat="server" CellSpacing="0" DataKeyFields="JobCostCodeId" AutoGenerateColumns="true" AutoGenerateBands="false" Width="100%" AjaxIndicator-AjaxIndicator-ImageUrl="../../images/indicator_bar.gif" AjaxIndicator-AltText="" BorderStyle="None" EnableViewState="true" EnableDataViewState="False" ShowFooter="true" ShowHeader="true" InitialExpandDepth="0" InitialDataBindDepth="0" OnInit="grdDetails_Init"> <Columns> <ig:BoundDataField DataFieldName="JobCostCode" CssClass="igg_TextAlignLeft" Key="JobCostCode" Header-Text="Cost Code" Width="15%" /> <ig:BoundDataField DataFieldName="JobCostCodeDescription" CssClass="igg_TextAlignLeft" Key="JobCostCodeDescription" Header-Text="Cost Code Description" Width="85%" /> </Columns> <Bands> <ig:Band AutoGenerateColumns="False" Width="100%" ShowFooter="false" ShowHeader="false" DataMember="dt1" DataKeyFields="JobCostCodeId"> <Columns> <ig:BoundDataField DataFieldName="JobCostCodeId" DataType="System.Int32" Key="JobCostCodeId" Width="100px" Hidden="true"> <Header Text="Id" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Type" Key="Type" DataType="System.String" CssClass="igg_TextAlignLeft"> <Header Text="Type" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:Sorting> </ig:Sorting> </Behaviors> </ig:Band> <ig:Band AutoGenerateColumns="False" Width="100%" ShowFooter="true" ShowHeader="true" DataMember="dt2" DataKeyFields="Type"> <Columns> <ig:BoundDataField DataFieldName="Company" DataType="System.String" Key="Company" Width="70px"> <Header Text="Company" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Contact" DataType="System.String" Key="Contact" Width="150px"> <Header Text="Contact" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Date" DataType="System.Date" Key="Date" Width="70px"> <Header Text="Date" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ItemMainNumber" DataType="System.String" Key="ItemMainNumber" Width="70px"> <Header Text="Number" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ItemSubtotal" DataType="System.Double" Key="ItemSubtotal" Width="70px"> <Header Text="Subtotal" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ItemTaxTotal" DataType="System.Double" Key="ItemTaxTotal" Width="70px"> <Header Text="Tax" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="ItemTotal" DataType="System.Double" Key="ItemTotal" Width="70px"> <Header Text="Total" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:Sorting Enabled="false"> </ig:Sorting> </Behaviors> </ig:Band> </Bands> </ig:WebHierarchicalDataGrid>
Code to bind grid
if (!Page.IsPostBack) { DataSet ds = new DataSet(); ds = BindData(); grdDetails.DataSource = ds; ExpandAll(); }
private DataSet BindData() { DataSet ds = new DataSet(); DataTable dtJCC = new DataTable(); dtJCC.Columns.Add("JobCostCodeId", typeof(int)); dtJCC.Columns.Add("ProjectNumber", typeof(string)); dtJCC.Columns.Add("JobCostCode", typeof(string)); dtJCC.Columns.Add("JobCostCodeDescription", typeof(string)); dtJCC.Rows.Add(1, "PN1", "01100", "Miscellaneous Items"); dtJCC.Rows.Add(2, "PN2", "02100", "Miscellaneous Items"); ds.Tables.Add(dtJCC); DataTable dt1 = new DataTable(); dt1.Columns.Add("JobCostCodeId", typeof(int)); dt1.Columns.Add("Type", typeof(string)); DataColumn dcDt1Index = new DataColumn("ID"); dcDt1Index.AutoIncrement = true; dcDt1Index.AutoIncrementSeed = 1; dcDt1Index.AutoIncrementStep = 1; dt1.Columns.Add(dcDt1Index); dt1.Rows.Add(1, "Prime Invoices FLS - Sched Values"); dt1.Rows.Add(1, "Prime Invoices FLS - COs"); dt1.Rows.Add(1, "Prime Invoices Cost Plus"); dt1.Rows.Add(1, "Prime Invoices Unit Price"); dt1.Rows.Add(1, "Bills"); DataTable dt2 = new DataTable(); dt2.Columns.Add("JobCostCodeId", typeof(int));//0 dt2.Columns.Add("Type", typeof(string));//1 dt2.Columns.Add("ItemKey", typeof(int));//2 dt2.Columns.Add("ItemMainKey", typeof(int));//3 dt2.Columns.Add("Company", typeof(string));//4 dt2.Columns.Add("Contact", typeof(string));//5 dt2.Columns.Add("Date", typeof(DateTime));//6 dt2.Columns.Add("ItemMainNumber", typeof(string));//7 dt2.Columns.Add("ItemNumber", typeof(int));//8 dt2.Columns.Add("ItemDescription", typeof(string));//9 dt2.Columns.Add("ItemQuantity", typeof(float));//10 dt2.Columns.Add("ItemUnit", typeof(string));//11 dt2.Columns.Add("ItemUnitPrice", typeof(decimal));//12 dt2.Columns.Add("ItemSubtotal", typeof(decimal));//13 dt2.Columns.Add("ItemTaxCode", typeof(string));//14 dt2.Columns.Add("ItemTaxTotal", typeof(decimal));//15 dt2.Columns.Add("ItemTotal", typeof(decimal));//16 dt2.Columns.Add("ItemResourceType", typeof(string));//17 dt2.Columns.Add("ItemMainStatus", typeof(string));//18 dt2.Columns.Add("PrimeContractNumber", typeof(string));//19 dt2.Columns.Add("PrimeContractType", typeof(short));//20 dt2.Columns.Add("ProjectNumber", typeof(string));//21 dt2.Columns.Add("ProjectTitle", typeof(string));//22 dt2.Columns.Add("JobCostCode", typeof(string));//23 dt2.Columns.Add("JobCostCodeDescription", typeof(string));//24 DataColumn dcDt2Index = new DataColumn("ID"); dcDt2Index.AutoIncrement = true; dcDt2Index.AutoIncrementSeed = 1; dcDt2Index.AutoIncrementStep = 1; dt2.Columns.Add(dcDt2Index); dt2.Rows.Add(1, "Prime Invoices FLS - Sched Values", 11, 012, "New Building supplier ", "Test", "2010-10-14", "231313", 14, "Millwork", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); dt2.Rows.Add(1, "Prime Invoices FLS - COs", 12, 013, "New Building supplier ", "Shyam", "2010-10-14", "231313", 14, "Millwork", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); dt2.Rows.Add(1, "Prime Invoices FLS - COs", 12, 013, "Contracting ", "John L", "2010-10-14", "231313", 14, "CPR # 026", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); dt2.Rows.Add(1, "Prime Invoices Cost Plus", 13, 014, "New Building supplier ", "John", "2010-10-14", "231313", 14, "Millwork", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); dt2.Rows.Add(1, "Prime Invoices Unit Price", 14, 015, "test ", "Ram", "2010-10-14", "231313", 14, "Millwork", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); dt2.Rows.Add(1, "Bills", 11, 012, "New Building supplier ", "Shyam", "2010-10-14", "231313", 14, "Millwork", 5, "Unit", 10.2, 1000.00, "GB", 12.00, 150.50, "T", "P", "0010", 1, "PN1", "01100", "Miscellaneous Items"); ds.Tables.Add(dt1); ds.Tables.Add(dt2); if (ds.Tables.Count > 1) { ds.Relations.Add("Level0Relationship", ds.Tables[0].Columns["JobCostCodeId"], ds.Tables[1].Columns["JobCostCodeId"]); if (ds.Tables.Count > 2) { DataColumn[] parentColumns = new DataColumn[] { ds.Tables[1].Columns["Type"], ds.Tables[1].Columns["JobCostCodeId"] }; DataColumn[] childColumns = new DataColumn[] { ds.Tables[2].Columns["Type"], ds.Tables[2].Columns["JobCostCodeId"] }; DataRelation relation1 = new DataRelation("Level1Relationship", parentColumns, childColumns); ds.Relations.Add("Level1Relationship", parentColumns, childColumns); } } dtJCC.PrimaryKey = new DataColumn[] { dtJCC.Columns["JobCostCodeId"] }; dt1.PrimaryKey = new DataColumn[] { dt1.Columns["ID"] }; dt2.PrimaryKey = new DataColumn[] { dt2.Columns["ID"] }; return ds; } protected void ExpandAll() { foreach (ContainerGridRecord row in grdDetails.GridView.Rows) { row.ExpandChildren(); } }
Please correct what is wrong
Thanks a lot, it does work.
Hello Mypost,
I have created a sample based on your code and I have found that "DataMember" property of the band is missing:
<Bands>
<ig:Band Key="ChildId" IsSelfReference="true" AutoGenerateColumns="false" DataKeyFields="ChildId" ShowHeader="false" DataMember="Level2">
You should set it to match the second table in the DataSet.
You should also set the grid "InitialDataBindDepth" property to "1" in order to load the child band data:
InitialDataBindDepth
="1"
After you do that the message dissapears and the child band is displayed.
Let me know if you have further questions.