473,661 Members | 2,457 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 1585
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***@discussi ons.microsoft.c om> wrote in message
news:2B******** *************** ***********@mic rosoft.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.DataS ource = intentory.GetLi st();
dataGrid1.DataB ind();

Add this before you DataBind() call:

dataGrid1.DataK eyField = "PartID"; // Assuming PartID is serializable

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

string partID = dataGrid1.DataK eys[e.Item.ItemInde x].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.c om> wrote in message
news:gP******** ************@gi ganews.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.DataS ource = intentory.GetLi st();
dataGrid1.DataB ind();

Add this before you DataBind() call:

dataGrid1.DataK eyField = "PartID"; // Assuming PartID is serializable

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

string partID = dataGrid1.DataK eys[e.Item.ItemInde x].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 lines to change the appearance of your timer var occasion="" var message_on_occasion="Auction Closed" var countdownwidth='220px' var countdownheight='35px'
6
1612
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 Temperature</title>
4
1927
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" "http://www.w3.org/TR/html4/loose.dtd"> <html> <title>Calculator</title> <script language="Javascript"> <!-- Begin Hiding var total = 0
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 table as structure thus (this is all an example) PartID (string) Part Code (string)
15
2006
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: www.carsoftnet.com.br/temp/sample_error_date.zip
4
1349
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) Data is pulled from the internet and stored to a CSV file 2) Data is loaded into the database with some changes 3) All sorts of data crunching goes on. Step one works fine -- data is saved to a csv file. Step 2 -- The data is loaded...
1
1869
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 javascript. Depending on which tab panel is visible upon the submit, I want to execute the appropriate javascript validation. When I submit the form, is there a way to conditionally check or fire the requiredfieldvalidators? Do you place the...
15
2063
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 correct. I want this to run when the DB is opened, I would also like the text box to be starred (*) out when text is input. Thanks for your help. ==============================
0
931
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 SqlDataReader, I get a DataTable with DataColumns equal to False. However, the same method in SQL Server 2005 will return a DataTable with DataColumns equal to True. Changing the code to use SqlDataAdapter.Fill method fixes the issue but does anyone know...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1740
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.