473,385 Members | 2,015 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,385 software developers and data experts.

Hide Datagrid columns

I have a dataset with two tables.

I make data view of each table, connect the parent table to one data grid
and the child table to the other datagrid, with a row filter, that gets set
when a user clicks a row in the parent.

I have PK/FK in the tables to know what to display.

I want to hide the PK/FK columns in the U/I, but still use them.

I can't seem to find a way to do this.

Any help would be appreciated.

Thanks,

Shane
Nov 21 '05 #1
5 1476
Shane Story wrote:
I have a dataset with two tables.

I make data view of each table, connect the parent table to one data grid
and the child table to the other datagrid, with a row filter, that gets set
when a user clicks a row in the parent.

I have PK/FK in the tables to know what to display.

I want to hide the PK/FK columns in the U/I, but still use them.

I can't seem to find a way to do this.

Any help would be appreciated.

Thanks,

Shane


You have to assign a DataGridTableStyle to the datagrid. Then when you
attach the DataSource only columns that have a DataGridColumnStyle will
be shown but you can still access the other column from the datasource.

Hope this helps.

Chris
Nov 21 '05 #2

"Shane Story" <sstoryREMOVETHIS at lburgus dot com> wrote in message
news:ej*************@TK2MSFTNGP09.phx.gbl...
I have a dataset with two tables.

I make data view of each table, connect the parent table to one data grid
and the child table to the other datagrid, with a row filter, that gets
set
when a user clicks a row in the parent.

I have PK/FK in the tables to know what to display.

I want to hide the PK/FK columns in the U/I, but still use them.

I can't seem to find a way to do this.

Any help would be appreciated.

Thanks,

Shane


Is this ASP.Net or WinForms? Not sure how to do the equivalent in WinForms,
but in ASP.Net you would handle the DataGrid_DataItemBound event. Check to
see if e.Item.ItemType is the type you want to mess with, then convert
e.Item.DataItem.Row to your DataRow. That would give you all values for the
DataItem that was bound.

HTH,
Mythran

Nov 21 '05 #3
It is a Win forms app. I already have it doing this... just have problems
because I need to hide columns and the one I need to hide is the PK in the
parent that I need to use for hidden FK in the child.
"Mythran" <ki********@hotmail.comREMOVETRAIL> wrote in message
news:uy**************@TK2MSFTNGP14.phx.gbl...

"Shane Story" <sstoryREMOVETHIS at lburgus dot com> wrote in message
news:ej*************@TK2MSFTNGP09.phx.gbl...
I have a dataset with two tables.

I make data view of each table, connect the parent table to one data grid and the child table to the other datagrid, with a row filter, that gets
set
when a user clicks a row in the parent.

I have PK/FK in the tables to know what to display.

I want to hide the PK/FK columns in the U/I, but still use them.

I can't seem to find a way to do this.

Any help would be appreciated.

Thanks,

Shane
Is this ASP.Net or WinForms? Not sure how to do the equivalent in

WinForms, but in ASP.Net you would handle the DataGrid_DataItemBound event. Check to see if e.Item.ItemType is the type you want to mess with, then convert
e.Item.DataItem.Row to your DataRow. That would give you all values for the DataItem that was bound.

HTH,
Mythran

Nov 21 '05 #4
Shane,

Did you already have a look at our website, it is based on VBNet and has a
lot of samples for the Datagrid.

http://www.windowsformsdatagridhelp.com/default.aspx

I hope this helps,

Cor
Nov 21 '05 #5
Thanks for the link.

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Shane,

Did you already have a look at our website, it is based on VBNet and has a
lot of samples for the Datagrid.

http://www.windowsformsdatagridhelp.com/default.aspx

I hope this helps,

Cor

Nov 21 '05 #6

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

Similar topics

2
by: Andrew Chen | last post by:
How do I hide any particular DataGrid Cell from visible, or any DataColumn for the matter?
6
by: Das | last post by:
Hi everyone, I'm using datagrid control to display the data. I want to hide column to be displayed into the data grid. I'm using the code as given below: Method given below is used to bind the...
4
by: Tim | last post by:
Hi, I am trying to hide the datagrid row header (the left most column that has the 'select' triangle in it which moves with the selected row). It seems to be fairly simple;...
1
by: J Gao | last post by:
Hi All, I am using Data binding with DataGrid. I need to hide column in the grid using DataGrid1.Columns(1).Visible = False But I get the following error message Description: An unhandled...
2
by: Thanh Nu | last post by:
Hi, I would like to hide a column in a web datagrid (with create columns automatically at runtime checked), and I cannot refer to the columns collection like this: DataGrid1.Columns(0).Visible...
8
by: Hanson | last post by:
I have a datagrid control in an aspx page. The datagrid columns will be dynamically generated according to the pre-page's search condition, I want to hide some columns in the datagrid. is that...
3
by: sivaraman.S | last post by:
Hi friends, How to hide a column in datagrid. regards, Sivaraman.S
5
by: J | last post by:
Ok, they have changed a lot of stuff in VB.net. How in the world do you hide a column on the Datagrid? -- Jason
1
by: nuhura01 | last post by:
Hi all.. I have a datagrid in my system and I preview the datagrid in other html page. Below are the code that I'm using: Dim oStringWriter As System.IO.StringWriter = New...
9
by: moondaddy | last post by:
using c# 3.5 I have list of business objects which I will use in lists for databinding and I want to hide some of the fields so they don't show up in the list control. some of my list will be:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.