Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Hierarchical Grid not loading Data
posted

 

I am trying to get a hierarchical web grid to work and not getting any data to load. Below are my html and c# code. Thank you

My version is

Version=6.2.20062.1059
 
<igtbl:UltraWebGrid ID="gridProject" runat="server" Width="100%" DataKeyField="Projects" OnInitializeRow="gridProject_InitializeRow"
	DisplayLayout-ViewType="Hierarchical">
	<Bands>
		<igtbl:UltraGridBand BaseTableName="Territory" Expandable="Yes" 
			DataKeyField="Projects">
			<Columns>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="TerritoryID"
					Key="TerritoryID">
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="TerritoryName"
					Key="TerritoryName">
					<Header>
						<RowLayoutColumnInfo OriginX="1" />
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="1" />
					</Footer>
				</igtbl:UltraGridColumn>
			</Columns>
			<FilterOptions>
				<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
					BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
					Font-Size="11px" Width="200px">
					<Padding Left="2px"></Padding>
				</FilterDropDownStyle>
				<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
				</FilterHighlightRowStyle>
			</FilterOptions>
			<AddNewRow Visible="Yes">
			</AddNewRow>
		</igtbl:UltraGridBand>
		<igtbl:UltraGridBand BaseTableName="Job" Expandable="Yes" 
			DataKeyField="PAProjID" IndentationType="Indented">
			<Columns>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="PAProjID" 
					Key="PAProjID">
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Job No" 
					Key="Job No">
					<Header>
						<RowLayoutColumnInfo OriginX="1" />
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="1" />
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="JobDesc" 
					Key="JobDesc">
					<Header>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="TerritoryID"
					Key="TerritoryID">
					<Header>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
			</Columns>
			<FilterOptions>
				<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
					BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
					Font-Size="11px" Width="200px">
					<Padding Left="2px"></Padding>
				</FilterDropDownStyle>
				<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
				</FilterHighlightRowStyle>
			</FilterOptions>
			<AddNewRow Visible="Yes" View="Bottom">
			</AddNewRow>
		</igtbl:UltraGridBand>
		<igtbl:UltraGridBand BaseTableName="SMContract" Expandable="Yes" 
			ChildBandColumn="SMCID" DataKeyField="SMCID" IndentationType="Indented">
			<Columns>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="SMCID" 
					Key="SMCID">
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="SMCDesc" 
					Key="SMCDesc">
					<Header>
						<RowLayoutColumnInfo OriginX="1" />
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="1" />
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="PAProjID" 
					Key="PAProjID">
					<Header>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
			</Columns>
			<FilterOptions>
				<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
					BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
					Font-Size="11px" Width="200px">
					<Padding Left="2px"></Padding>
				</FilterDropDownStyle>
				<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
				</FilterHighlightRowStyle>
			</FilterOptions>
			<AddNewRow Visible="Yes" View="Bottom">
			</AddNewRow>
		</igtbl:UltraGridBand>
		<igtbl:UltraGridBand BaseTableName="Location" Expandable="Yes" 
			ChildBandColumn="LocID" DataKeyField="LocID" IndentationType="Indented">
			<Columns>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="SMCID" 
					Key="SMCID">
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="LocID" 
					Key="LocID">
					<Header>
						<RowLayoutColumnInfo OriginX="1" />
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="1" />
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Building" 
					Key="Building">
					<Header>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Address" 
					Key="Address">
					<Header>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="City" 
					Key="City">
					<Header>
						<RowLayoutColumnInfo OriginX="4"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="4"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="State" 
					Key="State">
					<Header>
						<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Zip" 
					Key="Zip">
					<Header>
						<RowLayoutColumnInfo OriginX="6"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="6"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
			</Columns>
			<FilterOptions>
				<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
					BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
					Font-Size="11px" Width="200px">
					<Padding Left="2px"></Padding>
				</FilterDropDownStyle>
				<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
				</FilterHighlightRowStyle>
			</FilterOptions>
			<AddNewRow Visible="Yes" View="Bottom">
			</AddNewRow>
		</igtbl:UltraGridBand>
		<igtbl:UltraGridBand BaseTableName="Units" Expandable="Yes" 
			DataKeyField="UnitID" IndentationType="Indented">
			<Columns>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="UnitID" 
					Key="UnitID">
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="LocID" 
					Key="LocID">
					<Header>
						<RowLayoutColumnInfo OriginX="1" />
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="1" />
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Unit" 
					Key="Unit">
					<Header>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="2"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Type" 
					Key="Type">
					<Header>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="3"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Manufacture"
					Key="Manufacture">
					<Header>
						<RowLayoutColumnInfo OriginX="4"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="4"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Controller" 
					Key="Controller">
					<Header>
						<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="5"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
				<igtbl:UltraGridColumn Type="Custom" IsBound="True" BaseColumnName="Description"
					Key="Description">
					<Header>
						<RowLayoutColumnInfo OriginX="6"></RowLayoutColumnInfo>
					</Header>
					<Footer>
						<RowLayoutColumnInfo OriginX="6"></RowLayoutColumnInfo>
					</Footer>
				</igtbl:UltraGridColumn>
			</Columns>
			<FilterOptions>
				<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
					BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
					Font-Size="11px" Width="200px">
					<Padding Left="2px"></Padding>
				</FilterDropDownStyle>
				<FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
				</FilterHighlightRowStyle>
			</FilterOptions>
			<AddNewRow Visible="Yes" View="Bottom" >
			</AddNewRow>
		</igtbl:UltraGridBand>
	</Bands>
	<DisplayLayout AutoGenerateColumns="true" AllowSortingDefault="OnClient" HeaderClickActionDefault="SortSingle"
		ViewType="Hierarchical">
		<FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderWidth="1px" BorderStyle="Solid"
			Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Width="100%">
		</FrameStyle>
		<Pager>
			<Style BackColor="LightGray" BorderWidth="1px" BorderStyle="Solid">
<BorderDetails ColorLeft="WhiteColorTop="WhiteWidthLeft="1pxWidthTop="1px"></BorderDetails>
</Style>
		</Pager>
		<EditCellStyleDefault BorderWidth="0px" BorderStyle="None">
		</EditCellStyleDefault>
		<FooterStyleDefault BackColor="LightGray" BorderWidth="1px" BorderStyle="Solid">
			<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px">
			</BorderDetails>
		</FooterStyleDefault>
		<HeaderStyleDefault HorizontalAlign="Left" BackColor="LightGray" BorderStyle="Solid">
			<BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px">
			</BorderDetails>
		</HeaderStyleDefault>
		<RowStyleDefault BackColor="Window" BorderColor="Silver" BorderWidth="1px" BorderStyle="Solid">
			<Padding Left="3px"></Padding>
			<BorderDetails ColorLeft="Window" ColorTop="Window"></BorderDetails>
		</RowStyleDefault>
		<GroupByRowStyleDefault BackColor="Control" BorderColor="Window">
		</GroupByRowStyleDefault>
		<GroupByBox>
			<Style BackColor="ActiveBorder" BorderColor="Window"></Style>
		</GroupByBox>
		<AddNewBox Hidden="False">
			<Style BackColor="Window" BorderColor="InactiveCaption" BorderWidth="1px" BorderStyle="Solid">
<BorderDetails ColorLeft="WhiteColorTop="WhiteWidthLeft="1pxWidthTop="1px"></BorderDetails>
</Style>
		</AddNewBox>
		<FilterOptionsDefault>
			<FilterDropDownStyle CustomRules="overflow:auto;" BackColor="White" BorderColor="Silver"
				BorderWidth="1px" BorderStyle="Solid" Font-Names="Verdana,Arial,Helvetica,sans-serif"
				Font-Size="11px" Width="200px">
				<Padding Left="2px"></Padding>
			</FilterDropDownStyle>
			<FilterHighlightRowStyle BackColor="#151C55" ForeColor="#FFFFFF">
			</FilterHighlightRowStyle>
		</FilterOptionsDefault>
	</DisplayLayout>
</igtbl:UltraWebGrid>
 
DataSet ds = new DataSet("Projects");
		DataColumn[] keys = new DataColumn[1];
 
		ds.Tables.Add(new DataTable("Territory"));
		ds.Tables["Territory"].Columns.Add(new DataColumn("TerritoryID"typeof(int)));
		ds.Tables["Territory"].Columns.Add(new DataColumn("TerritoryName"typeof(string)));
		keys[0= ds.Tables["Territory"].Columns["TerritoryID"];
		ds.Tables["Territory"].PrimaryKey = keys;
		
		//vMcpSearchView
		ds.Tables.Add(new DataTable("Job"));
		ds.Tables["Job"].Columns.Add(new DataColumn("PAProjID"typeof(int)));
		ds.Tables["Job"].Columns.Add(new DataColumn("Job No"typeof(string)));
		ds.Tables["Job"].Columns.Add(new DataColumn("JobDesc"typeof(string)));
		ds.Tables["Job"].Columns.Add(new DataColumn("TerritoryID"typeof(int)));
		keys[0= ds.Tables["Job"].Columns["PAProjID"];
		ds.Tables["Job"].PrimaryKey = keys;
 
		//SmContract
		ds.Tables.Add(new DataTable("SMContract"));
		ds.Tables["SMContract"].Columns.Add(new DataColumn("SMCID"typeof(int)));
		ds.Tables["SMContract"].Columns.Add(new DataColumn("SMCDesc"typeof(string)));
		ds.Tables["SMContract"].Columns.Add(new DataColumn("PAProjID"typeof(int)));
		keys[0= ds.Tables["SMContract"].Columns["SMCID"];
		ds.Tables["SMContract"].PrimaryKey = keys;
 
		//vMcpLocationsView
		ds.Tables.Add(new DataTable("Location"));
		ds.Tables["Location"].Columns.Add(new DataColumn("SMCID"typeof(int)));
		ds.Tables["Location"].Columns.Add(new DataColumn("LocID"typeof(int)));
		ds.Tables["Location"].Columns.Add(new DataColumn("Building"typeof(string)));
		ds.Tables["Location"].Columns.Add(new DataColumn("Address"typeof(string)));
		ds.Tables["Location"].Columns.Add(new DataColumn("City"typeof(string)));
		ds.Tables["Location"].Columns.Add(new DataColumn("State"typeof(string)));
		ds.Tables["Location"].Columns.Add(new DataColumn("Zip"typeof(string)));
		keys[0= ds.Tables["Location"].Columns["LocID"];
		ds.Tables["Location"].PrimaryKey = keys;
 
		//vFrmElevMainView
		ds.Tables.Add(new DataTable("Units"));
		ds.Tables["Units"].Columns.Add(new DataColumn("UnitID"typeof(int)));
		ds.Tables["Units"].Columns.Add(new DataColumn("LocID"typeof(int)));
		ds.Tables["Units"].Columns.Add(new DataColumn("Unit"typeof(string)));
		ds.Tables["Units"].Columns.Add(new DataColumn("Type"typeof(string)));
		ds.Tables["Units"].Columns.Add(new DataColumn("Manufacture"typeof(string)));
		ds.Tables["Units"].Columns.Add(new DataColumn("Controller"typeof(string)));
		ds.Tables["Units"].Columns.Add(new DataColumn("Description"typeof(string)));
		keys[0= ds.Tables["Units"].Columns["UnitID"];
		ds.Tables["Units"].PrimaryKey = keys;
 
		
		DataRow rowTerr;
		DataRow rowPAProj;
		DataRow rowSMC;
		DataRow rowLoc;
		DataRow rowUnit;
 
		foreach (Territory terr in visMan.GetList<Territory>())
		{
			rowTerr = ds.Tables["Territory"].NewRow();
 
			rowTerr["TerritoryID"= terr.Id;
			rowTerr["TerritoryName"= terr.Description;
		}
 
		Search s = new Search();
		s.And(vMcpSearchView.Fields.Status"A");
		s.And(vMcpSearchView.Fields.TerritoryId8);
 
		foreach (vMcpSearchView mcp in visMan.GetList<vMcpSearchView>(s) )
		{
			rowPAProj = ds.Tables["Job"].NewRow();
 
			rowPAProj["PAProjID"= mcp.PaProjectId;
			rowPAProj["Job No"= mcp.Projectno;
			rowPAProj["JobDesc"= mcp.Descr;
			rowPAProj["TerritoryID"= mcp.TerritoryId;
 
			Search smcs = new Search();
			smcs.And(SmContract.Fields.PaProjectIdmcp.PaProjectId);
			smcs.And(SmContract.Fields.Active1);
 
			foreach (SmContract smc in visMan.GetList<SmContract>(smcs))
			{
				rowSMC = ds.Tables["SMContract"].NewRow();
 
				rowSMC["SMCID"= smc.SmContractsId;
				rowSMC["SMCDesc"= smc.ProjDesc;
				rowSMC["PAProjID"= smc.PaProjectId;
 
				foreach (vMcpLocationsView mcpl in visMan.GetList<vMcpLocationsView>(vMcpLocationsView.Fields.SmContractsIdsmc.SmContractsId))
				{
					rowLoc = ds.Tables["Location"].NewRow();
 
					rowLoc["SMCID"= mcpl.SmContractsId;
					rowLoc["LocID"= mcpl.LocationsId;
					rowLoc["Building"= mcpl.BldgName;
					rowLoc["Address"= mcpl.Address;
					rowLoc["City"= mcpl.City;
					rowLoc["State"= mcpl.State;
					rowLoc["Zip"= mcpl.Zip;
 
					foreach (vFrmElevMainView unit in visMan.GetList<vFrmElevMainView>(vFrmElevMainView.Fields.LocationsIdmcpl.LocationsId))
					{
						rowUnit = ds.Tables["Units"].NewRow();
 
						rowUnit["UnitID"= unit.ElevatorsId;
						rowUnit["LocID"= unit.LocationsId;
						rowUnit["Unit"= unit.Unit;
						rowUnit["Type"= unit.ElevTypeDesc;
						rowUnit["Manufacture"= unit.ElevManuDesc;
						rowUnit["Controller"= unit.ElevCtrlName;
						rowUnit["Description"= unit.Description;
					}
				}
			}
		}
		ds.Relations.Add(ds.Tables["Territory"].Columns["TerritoryID"], ds.Tables["Job"].Columns["TerritoryID"]);
		ds.Relations.Add(ds.Tables["Job"].Columns["PAProjID"], ds.Tables["SMContract"].Columns["PAProjID"]);
		ds.Relations.Add(ds.Tables["SMContract"].Columns["SMCID"], ds.Tables["Location"].Columns["SMCID"]);
		ds.Relations.Add(ds.Tables["Location"].Columns["LocID"], ds.Tables["Units"].Columns["LocID"]);
 
		gridProject.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.Hierarchical;
		
		gridProject.DataSource = ds;
		gridProject.DataBind();
Parents
No Data
Reply
  • 265
    Verified Answer
    posted

    OK I think I may have figured out what was wrong, I was not adding the rows to the tables. So I added lines like

    ds.Tables["Units"].Rows.Add(rowUnit);
    

    Though is there a way to get it to query only when an item is expanded? This would be great since the data I am pulling is quite large.

    Thank you,

Children
No Data