471,354 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 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 1569
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Billy Jacobs | last post: by
1 post views Thread by Tom Rahav | last post: by
3 posts views Thread by JAdrianB | last post: by
1 post views Thread by fiaolle | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.