473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hiding a Column in a Child Table within DataGrid

Hello,

I am trying to hide a column in a child table within a windows form
DataGrid control.

I am populating the Datagrid datasource with an dataset which is
populated with hierarchical XML only 2 levels deep.

XML:
<Customers id="123" name="Joe" level="A">
<Orders id="1234" date="2004-04-02" level="A"/>
<Orders id="1236" date="2004-04-02" level="B"/>
<Orders id="1233" date="2004-04-02" level="C"/>
</customers>
<Customers id="098" name="Mike" level="A">
<Orders id="1274" date="2004-04-02" level="A"/>
<Orders id="1276" date="2004-04-02" level="B"/>
<Orders id="1203" date="2004-04-02" level="C"/>
</customers>
<Customers id="757" name="Pat" level="A">
<Orders id="1433" date="2004-04-02" level="A"/>
<Orders id="1432" date="2004-04-02" level="B"/>
<Orders id="1421" date="2004-04-02" level="C"/>
</customers>

I am populating the datagrid fine and displays the 2nd table fine.

I can hide the level column in the parent table but not the second.
I am having trouble trying to hide the "level" Column within the 2nd
table. How can I acheive this?

My Code:

foreach(DataTable dTable in ds.Tables)
{
DataGridTableStyle dgStyle = new DataGridTableStyle();
dgStyle.MappingName = dTable.TableName;
dataGrid1.TableStyles.Add(dgStyle);
}

dataGrid1.SetDataBinding( ds, "Customers" );

//Should go thru each table but doesn't
foreach(DataGridTableStyle gridStyle in dataGrid1.TableStyles)
{
foreach(DataGridColumnStyle colStyle in gridStyle.GridColumnStyles)
{
if ( colStyle.MappingName == "level" )
{
colStyle.Width = 0;
}
}
}
thanks

lanky

Nov 16 '05 #1
0 1153

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim | last post by:
I'm trying to allow the user to define which columns in a datagrid should be hidden. I have gotten this to work for a datagrid that has only one table in its dataset, however, I can't get it to...
2
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
3
by: Edward Mostrom | last post by:
I have 2 tables that have a relation between them. The parent table also has an expression in a column that sums the values in the child table. Both tables are hooked up to datagrids. ...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
0
by: Ross | last post by:
ASP.NET Problem: I have a dataset with a parent table and a child table. For every row in the parent table there are ~1/2 dozen corresponding records in the child table. In the ASPX page I have a...
0
by: DraguVaso | last post by:
Hi, I have in my VB.NET-application a DataGrid with two DataTables in with a Parent-Child-relationship defined. When the users clicks on a call in the DataGrid, i want to know the MappingName...
5
by: Rich | last post by:
I have a datagrid that uses a dataview object for its datasource. The dataview contains a unique row identifier column. I don't want to display this column in the datagrid. I need the unique row...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
1
by: jack | last post by:
Hi all, My datagrid have too many columns which are going out of screen. one of the solution is to group the columns and make only the total column visible at the initial stage. What now i...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.