Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Theres 2 tables in this dataset. They have a relation between a column called "Reporting Date"

When I take this dataset and bind these to a grid I can access the first table through Grid.PrimaryGrid.Columns but I can't access the second table which is nested to the first table.

For the table that is displayed as the "Primary Grid" you can drop down and see nested records from the second table but I cannot edit the second tables headers. How do I edit the second table's headertext?
for the first table I can do this to change the header text for each specific column:
Grid1.PrimaryGrid.Columns["SoldOz"].HeaderText = "Total Sold Oz";


for example I have the following code:

C#
//DATASET
DataSet DSHourly = new DataSet();

//TABLES
DataTable TBCondensed = DSHourly.Tables.Add("TBCondensed");
DataTable TBHourly = DSHourly.Tables.Add("TBHourly");

//RELATION
DSHourly.Relations.Add("1", DSHourly.Tables["TBCondensed"].Columns["ReportingDate"], DSHourly.Tables["TBHourly"].Columns["ReportingDate"], false);

//BINDING TO GRID
Grid1.DataSource = DSHourly;
Grid1.DataMember = "TBCondensed";

//HEADER TEXT FOR PRIMARY TABLE
Grid1.PrimaryGrid.Columns["SoldOz"].HeaderText = "Total Sold Oz";
Posted
Updated 12-Jan-12 3:55am
v2
Comments
Sergey Alexandrovich Kryukov 11-Jan-12 22:55pm    
OK, "child table", "parent table", "nested table". What do you mean by that? Could you re-phrase it is relational way, which assumes there are only tables and relations?
--SA
roman_s 12-Jan-12 9:53am    
theres 2 tables in this dataset. They have a relation between a column called "Reporting Date"

When I take this dataset and bind these to a grid I can access the first table through Grid.PrimaryGrid.Columns but I can't access the second table which is nested to the first table.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900