Hiding column in Datagrid

G

Guest

Hi,
I am workin on a Smart Device Application Project (VS.NET 2003) and needed
to hide a column in a datagrid. I tried to use MappingType.Hidden, but it
doesnt seem to work. The below code works fine in WinForm but not in Smart
Device application.

DataTable dt = new DataTable("Test");
dt.Columns.Add("Dpt",Type.GetType("System.String"));
dt.Columns.Add("Vendor",Type.GetType("System.String"));
dt.Columns.Add("Start",Type.GetType("System.String"));
dt.Columns.Add("End",Type.GetType("System.String"));

DataRow row = dt.NewRow();
row.ItemArray = new object[]{"21","MAYTAG","04/02/04","04/06/04"};
dt.Rows.Add(row);

DataRow row1 = dt.NewRow();
row1.ItemArray = new object[]{"20","GE","04/02/04","04/06/04"};
dt.Rows.Add(row1);

DataSet ds = new DataSet("dSet");
ds.Tables.Add(dt);
ds.Tables["Test"].Columns["Vendor"].ColumnMapping =
MappingType.Hidden;
dataGrid1.DataSource = ds.Tables["Test"];

The above code hides "Vendor" column perfectly for a winform but not in
SmartDevice (compact framwork).
Please help!
Thanks,
Naresh
 
I

Ilya Tumanov [MS]

G

Guest

HI Ilya,
Thanks for your help. From one of the search results I found the solution.
However, none of the search results tell exactly whether MappingType.Hidden
really works or not in .NETCF.
tHANKS,
Naresh Mirkhelkar

Ilya Tumanov said:
http://groups.google.com/group/micr...+data+grid&qt_g=1&searchnow=Search+this+group

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Naresh Mirkhelkar said:
Hi,
I am workin on a Smart Device Application Project (VS.NET 2003) and needed
to hide a column in a datagrid. I tried to use MappingType.Hidden, but it
doesnt seem to work. The below code works fine in WinForm but not in Smart
Device application.

DataTable dt = new DataTable("Test");
dt.Columns.Add("Dpt",Type.GetType("System.String"));
dt.Columns.Add("Vendor",Type.GetType("System.String"));
dt.Columns.Add("Start",Type.GetType("System.String"));
dt.Columns.Add("End",Type.GetType("System.String"));

DataRow row = dt.NewRow();
row.ItemArray = new
object[]{"21","MAYTAG","04/02/04","04/06/04"};
dt.Rows.Add(row);

DataRow row1 = dt.NewRow();
row1.ItemArray = new object[]{"20","GE","04/02/04","04/06/04"};
dt.Rows.Add(row1);

DataSet ds = new DataSet("dSet");
ds.Tables.Add(dt);
ds.Tables["Test"].Columns["Vendor"].ColumnMapping =
MappingType.Hidden;
dataGrid1.DataSource = ds.Tables["Test"];

The above code hides "Vendor" column perfectly for a winform but not in
SmartDevice (compact framwork).
Please help!
Thanks,
Naresh
 
I

Ilya Tumanov [MS]

The link with answer to that is below.


--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Naresh Mirkhelkar said:
HI Ilya,
Thanks for your help. From one of the search results I found the solution.
However, none of the search results tell exactly whether
MappingType.Hidden
really works or not in .NETCF.
tHANKS,
Naresh Mirkhelkar

Ilya Tumanov said:
http://groups.google.com/group/micr...+data+grid&qt_g=1&searchnow=Search+this+group

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Naresh Mirkhelkar said:
Hi,
I am workin on a Smart Device Application Project (VS.NET 2003) and
needed
to hide a column in a datagrid. I tried to use MappingType.Hidden, but
it
doesnt seem to work. The below code works fine in WinForm but not in
Smart
Device application.

DataTable dt = new DataTable("Test");
dt.Columns.Add("Dpt",Type.GetType("System.String"));
dt.Columns.Add("Vendor",Type.GetType("System.String"));
dt.Columns.Add("Start",Type.GetType("System.String"));
dt.Columns.Add("End",Type.GetType("System.String"));

DataRow row = dt.NewRow();
row.ItemArray = new
object[]{"21","MAYTAG","04/02/04","04/06/04"};
dt.Rows.Add(row);

DataRow row1 = dt.NewRow();
row1.ItemArray = new
object[]{"20","GE","04/02/04","04/06/04"};
dt.Rows.Add(row1);

DataSet ds = new DataSet("dSet");
ds.Tables.Add(dt);
ds.Tables["Test"].Columns["Vendor"].ColumnMapping =
MappingType.Hidden;
dataGrid1.DataSource = ds.Tables["Test"];

The above code hides "Vendor" column perfectly for a winform but not in
SmartDevice (compact framwork).
Please help!
Thanks,
Naresh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top