473,386 Members | 1,694 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,386 software developers and data experts.

Datagrid: Linking combobox columns?

I'm trying to use a datagrid for data entry. I've created a couple of combo
box columns using information from
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q

That example basically sets every combobox in a given column (for every row)
to the same datasource.

One obstacle I have to overcome is when a user changes a value in one
column, the next combobox in the next column on the same row needs to bind to
a new set of data, and only for that row. For example, Column A is Cost
Centers, Column B is Job Codes. If I select a Cost Center from Column A, the
combo in Column B needs to list only valid Job Codes for the previously
selected Cost Center, on a row-by-row basis.

Any idea how to do this, or is there a sample somewhere someone could point
me to?

Thanks!

Jul 21 '05 #1
3 1699
JV
You just need to set up the combo box to allow postback so that you can hook
into the SelectionChanged event.
Similar to this:
http://msdn.microsoft.com/library/de...ebcontrols.asp

You may want to also consider the thoughts in this article:
http://msdn.microsoft.com/library/de...ebcontrols.asp

"JAdrianB" <JA******@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
I'm trying to use a datagrid for data entry. I've created a couple of
combo
box columns using information from
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q

That example basically sets every combobox in a given column (for every
row)
to the same datasource.

One obstacle I have to overcome is when a user changes a value in one
column, the next combobox in the next column on the same row needs to bind
to
a new set of data, and only for that row. For example, Column A is Cost
Centers, Column B is Job Codes. If I select a Cost Center from Column A,
the
combo in Column B needs to list only valid Job Codes for the previously
selected Cost Center, on a row-by-row basis.

Any idea how to do this, or is there a sample somewhere someone could
point
me to?

Thanks!

Jul 21 '05 #2
Woops, sorry, I'm in the WinForms datagrid. ASP.Net handles this type of
thing pretty well, but I have to figure out how to pull it off on WinForms.
Thanks, though.

"JV" wrote:
You just need to set up the combo box to allow postback so that you can hook
into the SelectionChanged event.
Similar to this:
http://msdn.microsoft.com/library/de...ebcontrols.asp

You may want to also consider the thoughts in this article:
http://msdn.microsoft.com/library/de...ebcontrols.asp

"JAdrianB" <JA******@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
I'm trying to use a datagrid for data entry. I've created a couple of
combo
box columns using information from
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q

That example basically sets every combobox in a given column (for every
row)
to the same datasource.

One obstacle I have to overcome is when a user changes a value in one
column, the next combobox in the next column on the same row needs to bind
to
a new set of data, and only for that row. For example, Column A is Cost
Centers, Column B is Job Codes. If I select a Cost Center from Column A,
the
combo in Column B needs to list only valid Job Codes for the previously
selected Cost Center, on a row-by-row basis.

Any idea how to do this, or is there a sample somewhere someone could
point
me to?

Thanks!


Jul 21 '05 #3

In the Column A Combobox.SelectionChangeCommitted Event
You can reset Column B's combobox's datasource, or filter the job codes
for the selected Cost Center, assuming ComboBox B is bound to a
datatable or dataview.

David
"JAdrianB" <JA******@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
I'm trying to use a datagrid for data entry. I've created a couple of combo box columns using information from
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q

That example basically sets every combobox in a given column (for every row) to the same datasource.

One obstacle I have to overcome is when a user changes a value in one
column, the next combobox in the next column on the same row needs to bind to a new set of data, and only for that row. For example, Column A is Cost
Centers, Column B is Job Codes. If I select a Cost Center from Column A, the combo in Column B needs to list only valid Job Codes for the previously
selected Cost Center, on a row-by-row basis.

Any idea how to do this, or is there a sample somewhere someone could point me to?

Thanks!

Jul 21 '05 #4

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

Similar topics

7
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official...
1
by: Tom Rahav | last post by:
Hi! My question is if it's possible to adjust DataGrid control's columns' width by code (runtime). I have a DataGrid control that displays table from dataset that contains two fields. The first...
3
by: bafidi | last post by:
My problem is databind datagrid to combobox. i want to click to datagrid and i want to see that record at combobox and texboxes after that i want to change combobox and texboxes and i want to...
1
by: Jimmy | last post by:
Hi I want to display my datagrid with the columns horizontal and rows vertical, so just the other way around. For example instead of : name address city Tom ...
0
by: Trint Smith | last post by:
the less the data going to my datagrid, the wider the lines and columns...how can i keep the datagrid rows and columns the same size no matter how much data is being displayed? thanks, Trint ...
3
by: JAdrianB | last post by:
I'm trying to use a datagrid for data entry. I've created a couple of combo box columns using information from http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q480q That example basically sets...
0
by: zhuang | last post by:
Hi, Adding combobox to datagrid has been posted many times. I have a datagrid which has multiple combobox columns and normal textbox columns. But how could I change other combo box values at...
1
by: fiaolle | last post by:
Hi I have a DataGrid with ComboBox columns. I want the same thing to happen as when a user clicks and chooses an item in the ComboBox. When a user stands in the last row (new row) and clicks for...
1
by: alexmax2003 | last post by:
That quotation was add b4 i need to know from VB.Net wizards The answer "I'm trying to use a datagrid for data entry. I've created a couple of combo box columns using information from...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.