I've been combing documentation, the API's and this forum, but I am coming up a little short for my situation.
I have a DataSet with 3 DataTables.
ParentDataTable
ChildOneDataTable
ChildTwoDataTable
Each ChildDataTable is tied back to the ParentDataTable with a relation.
I would like to specify to show the the data in a heirarchical view between the ParentDataTable and ChildTwoDataTable.
I am setting the WebGrid.DataSource property in the code behind and then calling the DataBind Method.
How do I specify to show two bands and bind to the appropriate datatables in the dataset?
The version I'm using is NetAdvantage 3.5.
I am using this code to bind the grid, but its showing me only two levels why is that. please help . If i need to add more bands, how do i do that. In designer bands doesnt seem to be a colleciton. can u give me step by step to add bands if that is the missing part.
UI ->
<igtbl:UltraWebGrid ID="UG1" runat="server" Browser="Xml" Height="100%" Width="100%" OnDataBinding="UG1_DataBinding"> <DisplayLayout AllowAddNewDefault="Yes" RowHeightDefault="18px" Version="3.00" SelectTypeRowDefault="Single" ViewType="OutlookGroupBy" SelectTypeCellDefault="Extended" BorderCollapseDefault="Separate" AllowColSizingDefault="Free" Name="ctl00xUG1" TableLayout="Fixed" SelectTypeColDefault="Extended" AllowUpdateDefault="Yes"> <AddNewBox Hidden="False" ButtonConnectorStyle="Solid" ButtonConnectorColor="Silver" View="Compact"> <ButtonStyle Cursor="Hand" BorderWidth="1px" BorderColor="White" BorderStyle="Outset" BackColor="Gray"> </ButtonStyle> <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </BoxStyle> </AddNewBox> <Pager PageSize="20" Alignment="Center" AllowPaging="True"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black"> <Padding Left="0px" Top="2px" /> <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" /> </PagerStyle> </Pager> <HeaderStyleDefault BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana" BorderStyle="Solid" HorizontalAlign="Left" ForeColor="Black" BackColor="#CBD6A6"> <Padding Left="5px" Right="5px"></Padding> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </HeaderStyleDefault> <GroupByRowStyleDefault BorderWidth="1px" BorderColor="White" BorderStyle="Outset" BackColor="DarkGray"> </GroupByRowStyleDefault> <RowSelectorStyleDefault BorderWidth="1px" BorderStyle="None" BackColor="White"> </RowSelectorStyleDefault> <FrameStyle Width="100%" Cursor="Hand" BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana" BorderStyle="Solid" BackColor="#FAFCF1" Height="100%"> </FrameStyle> <FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </FooterStyleDefault> <ActivationObject BorderColor="170, 184, 131" BorderWidth=""> </ActivationObject> <GroupByBox ButtonConnectorStyle="Solid" ButtonConnectorColor="Silver"> <BandLabelStyle Cursor="Default" BorderWidth="1px" BorderColor="White" BorderStyle="Outset" BackColor="Gray"> </BandLabelStyle> <BoxStyle BackColor="DarkGray" BorderColor="White" BorderStyle="Outset" BorderWidth="1px"> </BoxStyle> </GroupByBox> <RowExpAreaStyleDefault BackColor="WhiteSmoke"> </RowExpAreaStyleDefault> <EditCellStyleDefault VerticalAlign="Middle" BorderWidth="0px" Font-Size="8pt" Font-Names="Verdana" BorderStyle="None" HorizontalAlign="Left"> </EditCellStyleDefault> <SelectedRowStyleDefault ForeColor="White" BackColor="#BECA98"> </SelectedRowStyleDefault> <SelectedGroupByRowStyleDefault BorderWidth="1px" BorderColor="White" BorderStyle="Outset" ForeColor="White" BackColor="#CF5F5B"> </SelectedGroupByRowStyleDefault> <RowAlternateStyleDefault BackColor="#E0E0E0"> </RowAlternateStyleDefault> <RowStyleDefault VerticalAlign="Middle" BorderWidth="1px" Font-Size="8pt" Font-Names="verdana" BorderColor="#AAB883" BorderStyle="Solid" HorizontalAlign="Left" ForeColor="#333333" BackColor="White"> <Padding Left="7px" Right="7px"></Padding> <BorderDetails WidthLeft="0px" WidthTop="0px"></BorderDetails> </RowStyleDefault> <Images> <CollapseImage Url="../Images/ig_treeXPMinus.GIF" /> <ExpandImage Url="../Images/ig_treeXPPlus.GIF" /> <CurrentRowImage Url="../Images/arrow_brown2_beveled.gif" /> <CurrentEditRowImage Url="../Images/arrow_brown2_beveled.gif" /> </Images> </DisplayLayout> <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> </igtbl:UltraWebGrid>
UI.cs->
Data layer -->
System.Data.DataSet contactsDataSet1 = new System.Data.DataSet();
SqlDataAdapter cmdCustomers = new SqlDataAdapter("select * from customer", dbConnection); SqlDataAdapter cmdOrders = new SqlDataAdapter("select * from location", dbConnection); SqlDataAdapter cmdSystems = new SqlDataAdapter("select * from systems", dbConnection); cmdCustomers.Fill(contactsDataSet1, "Customer"); cmdOrders.Fill(contactsDataSet1, "Location"); cmdSystems.Fill(contactsDataSet1, "Systems"); contactsDataSet1.Relations.Add("Customers", contactsDataSet1.Tables["Customer"].Columns["CustomerId"], contactsDataSet1.Tables["Location"].Columns["CustomerId"]);
contactsDataSet1.Relations.Add("Locations", contactsDataSet1.Tables["Location"].Columns["LocationId"], contactsDataSet1.Tables["Systems"].Columns["LocationId"]);
return contactsDataSet1;
elamberton,
Not a problem. One thing you might want to test for is removing the relationship. I seem to remember having a problem with that process. I do remember having to test for the existence of the relationship and then having issues with constraints. Kinda yukky. Regretfully, I can't find the code.
Good luck.
Changing the relationships in the DataSet did the trick. The grid view now displays the tables as expected.
Thanks Roger.
Roger Bogh said:By the way, me thinks you should consider upgrading. None of these ideas may work on a tool that is five years old. Back in 2003 (My guess based on the version being NetAdvantage 3.5) the Infragistics libraries were good for their day - but, not so good based on 2008. I am not and Infragistics employee. And, I don't sell any products.
By the way, me thinks you should consider upgrading. None of these ideas may work on a tool that is five years old. Back in 2003 (My guess based on the version being NetAdvantage 3.5) the Infragistics libraries were good for their day - but, not so good based on 2008. I am not and Infragistics employee. And, I don't sell any products.
Sorry I was unclear with the version, I am using "NetAdvantage for .NET 2008 Vol. 1 CLR 3.5".
I'm going to try to implement changing the relationship in the DataSet right now. Thanks for pointing me in that direction.
Yuk. I don't think you will have to create a gid band by band, row by row, cell by cell using code.
You just have to pick which tables your active relationship will be based on. It would probably be very confusing to the customer to have anything like two 'plus' expansion choices anyway.
Look at the way Microsoft Access does it and try that concept. Your problem is not technical but instead and interface issue. See my previous post for a potential solution.
I just would not run off and kluge a solution.