?
Solved

Assign Values to Hidden Columns in datagrid

Posted on 2011-04-19
7
Medium Priority
?
313 Views
Last Modified: 2012-05-11
I have a datagrid being displayed in a tab control.  Not all columns need displayed so I have no shown them.  When entering data, there are key fields that are assigned from a "header" part of the form.  The columns are:

Job_Number
Slip_Number
SWO_Number

The user enters these values elsewhere.  When the user enters rows in the datagrid and then saves, I need each row in the grid to have the columns Job Number, Slip Number, and SWO Number to be assigned the values in the textboxes txt_Slip_Number, txt_Job_Number and txt_SWO_Number?  

Please advise.  Thanks!
0
Comment
Question by:tobin46
  • 4
  • 2
7 Comments
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 35430421
Just a clairfication datagrid or gridview?

I know you already mentioned but some people say datagrid when actually they are refering is datagridview. Datagrid and datagridview is different.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 35431269
You can handle the DataTable.TableNewRow event and add the values to the columns(this assuming that you are using a datatable/dataset as the datasource of grid)

http://msdn.microsoft.com/en-us/library/system.data.datatable.tablenewrow.aspx
0
 
LVL 1

Author Comment

by:tobin46
ID: 35432881
@PagodNaUtak - sorry datagridview
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:tobin46
ID: 35437773
Maybe you could show me a sample of code that would add records to a db from a datagridview.
Columns 1, 2, 3, 4 - but Column 1 is hidden and the key and will be equal to a value in textbox_ID.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35438929
Did you try my suggestion?
0
 
LVL 1

Author Comment

by:tobin46
ID: 35440699
Just did.  Worked.  Thanks.
0
 
LVL 1

Author Comment

by:tobin46
ID: 35445447
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question