473,507 Members | 11,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help Required with hiding DataColumns

Fellow .Netters,

I have come to an impass trying to "hide" a column on a data grid - I'm sure
it's a fairly simple thing (but so am I, that's why I'm stuck)

Imagine if you will that I have a table as structure thus (this is all an
example)

PartID (string)
Part Code (string)
Description (string)
InStock (string)

Now, the PartID field is purely an internal code which has no display value
whatsoever but is needed internally by the system for various other purpose.

My Select statement is simply "Select * from Parts...." and what I want to
do is display all the columns, except the Part ID...but retain the PartID
for other actions required later (as it's in a specific format)

Please put me out of my misery and help me solve this...

Chris....

Jul 21 '05 #1
4 1565
Chris,

You can find just about everything you ever wanted to know about the WinForms DataGrid here:

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

Check out item 5.13 for your specific issue.
http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q708q

hth,
Steve
"Chris H." wrote:
Fellow .Netters,

I have come to an impass trying to "hide" a column on a data grid - I'm sure
it's a fairly simple thing (but so am I, that's why I'm stuck)

Imagine if you will that I have a table as structure thus (this is all an
example)

PartID (string)
Part Code (string)
Description (string)
InStock (string)

Now, the PartID field is purely an internal code which has no display value
whatsoever but is needed internally by the system for various other purpose.

My Select statement is simply "Select * from Parts...." and what I want to
do is display all the columns, except the Part ID...but retain the PartID
for other actions required later (as it's in a specific format)

Please put me out of my misery and help me solve this...

Chris....

Jul 21 '05 #2
Thanks....That's did the job....

"Steve" <St***@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
Chris,

You can find just about everything you ever wanted to know about the WinForms DataGrid here:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp

Check out item 5.13 for your specific issue.
http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q708q

hth,
Steve
"Chris H." wrote:
Fellow .Netters,

I have come to an impass trying to "hide" a column on a data grid - I'm sure it's a fairly simple thing (but so am I, that's why I'm stuck)

Imagine if you will that I have a table as structure thus (this is all an example)

PartID (string)
Part Code (string)
Description (string)
InStock (string)

Now, the PartID field is purely an internal code which has no display value whatsoever but is needed internally by the system for various other purpose.
My Select statement is simply "Select * from Parts...." and what I want to do is display all the columns, except the Part ID...but retain the PartID for other actions required later (as it's in a specific format)

Please put me out of my misery and help me solve this...

Chris....

Jul 21 '05 #3
Chris:

I know that your question has already been answered so you'll probably
never look here again, but you might try looking at the DataKeys
collection of the DataGrid to solve your problem in the future, rather
than relying on hidden columns.

Basically, when you are databinding, i.e.:

dataGrid1.DataSource = intentory.GetList();
dataGrid1.DataBind();

Add this before you DataBind() call:

dataGrid1.DataKeyField = "PartID"; // Assuming PartID is serializable

Later, in your ItemCommand event handler, you can just do this:

string partID = dataGrid1.DataKeys[e.Item.ItemIndex].ToString();

To retrieve the PartID. Makes things cleaner if you ask me... but you
didn't! :)

Enjoy,
Sean

Chris H. wrote:
Fellow .Netters,

I have come to an impass trying to "hide" a column on a data grid - I'm sure
it's a fairly simple thing (but so am I, that's why I'm stuck)

Imagine if you will that I have a table as structure thus (this is all an
example)

PartID (string)
Part Code (string)
Description (string)
InStock (string)

Now, the PartID field is purely an internal code which has no display value
whatsoever but is needed internally by the system for various other purpose.

My Select statement is simply "Select * from Parts...." and what I want to
do is display all the columns, except the Part ID...but retain the PartID
for other actions required later (as it's in a specific format)

Please put me out of my misery and help me solve this...

Chris....

Jul 21 '05 #4
Thanks Sean.....any advice is good at the moment, I'm still a novice at
this...just have to work out now how to make the grid Non-Edittable with Row
Selection (just a scrolling list that the user selects and then off it goes
and does some stuff....)
"Sean Bright" <se**@noreply.com> wrote in message
news:gP********************@giganews.com...
Chris:

I know that your question has already been answered so you'll probably
never look here again, but you might try looking at the DataKeys
collection of the DataGrid to solve your problem in the future, rather
than relying on hidden columns.

Basically, when you are databinding, i.e.:

dataGrid1.DataSource = intentory.GetList();
dataGrid1.DataBind();

Add this before you DataBind() call:

dataGrid1.DataKeyField = "PartID"; // Assuming PartID is serializable

Later, in your ItemCommand event handler, you can just do this:

string partID = dataGrid1.DataKeys[e.Item.ItemIndex].ToString();

To retrieve the PartID. Makes things cleaner if you ask me... but you
didn't! :)

Enjoy,
Sean

Chris H. wrote:
Fellow .Netters,

I have come to an impass trying to "hide" a column on a data grid - I'm sure it's a fairly simple thing (but so am I, that's why I'm stuck)

Imagine if you will that I have a table as structure thus (this is all an example)

PartID (string)
Part Code (string)
Description (string)
InStock (string)

Now, the PartID field is purely an internal code which has no display value whatsoever but is needed internally by the system for various other purpose.
My Select statement is simply "Select * from Parts...." and what I want to do is display all the columns, except the Part ID...but retain the PartID for other actions required later (as it's in a specific format)

Please put me out of my misery and help me solve this...

Chris....

Jul 21 '05 #5

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

Similar topics

3
582
by: adam | last post by:
<SCRIPT language=JavaScript1.2> function setcountdown(theyear,themonth,theday,thehour,themin,thesec){ yr=theyear;mo=themonth;da=theday;hr=thehour;min=themin;sec=thesec } // modify the following...
6
1596
by: Brian | last post by:
Help.. We cannot get this script to work..can someone take a look at it and make suggestions? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Convert...
4
1919
by: mwh | last post by:
Hi. If you remember, I posted Expressons Help. Now I am making a calculator with javascript. I can't get this to work: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
4
269
by: Chris H. | last post by:
Fellow .Netters, I have come to an impass trying to "hide" a column on a data grid - I'm sure it's a fairly simple thing (but so am I, that's why I'm stuck) Imagine if you will that I have a...
15
1996
by: Cesar Ronchese | last post by:
Hi, I built the sample code showing the problem with dates when viewed at different machines, different Time Zones and transported via Remoting. The zip can be downloaded here: ...
4
1341
by: Scott | last post by:
Ok. Brand new at this so please give a little patience and help me on the baby steps. I'm rewriting something I did initially in PHP / MySql on a vb.net / mysql platform. Here's what I'm doing:...
1
1861
by: Dave | last post by:
Hi, I'm using .NET 1.1 and wondering if I can use RequiredFieldValidators with required fields inside user controls. The page is a type of tabbed panel layout with the divs show/hidden using...
15
2054
by: colemanj4 | last post by:
Here is what I have so far, it loops while the PW is incorrect, or until cancel is selected. I want it to lock the tables for adds, deletes, and edits when cancel is selected, and if the PW is...
0
927
by: Nergock | last post by:
Have anyone run into this difference with SQL Server 2005 and the SqlDataTable Load method? In SQL Server 2000, when I create a table using the SqlDataTable.Load method passing it a...
0
7223
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
7314
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
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.