473,407 Members | 2,314 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,407 software developers and data experts.

datagrid combobox question

Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug
Nov 21 '05 #1
6 1765
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug

Nov 21 '05 #2
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.
Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug

Nov 21 '05 #3
Hi,

Say you have 50 rows in that column there is only one combobox that
is displayed when a cell in the column goes into edit mode. If you bind the
combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need to
clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row
that is being edited. You should add each item to the combobox manually.
If you bind the data you will wind up changing the values in multiple rows.
Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row
basis.

Can someone help.

Thanks

Doug


Nov 21 '05 #4
Ken,

I am still not sure what you are saying.

My combo box is bound to data not a string list and it is setting the value
just for the row that it is displayed within

I already have a datagrid with a combo box.
The Data Grid is bound to the "OrderDetails" Table.
The Combo Box is bound to the "Locations" Data Table.

When I set a value (ie a Location) in the DataGrid using the combo box, it
is setting the selected location for that record (Order Details Line ) only.
It is not affecting the other records (Rows) in the data Grid or in the
underlying Data Table ("OrderDetails")!!

I want to know if I can set the bound DataView to filter for the value
within the row rather than setting it as a column style.

Or is there some other way to achieve this result.

Say the datagrid is displaying records filtered for Order No 12345678 and it
has 10 lines.

Some of Line 3 might have arrived so the User has to accept say 20 boxes and
allocates them to location A20.
He selects row with Line: 3, Item: AA12345, Description: Blue Plastic,
Units: Boxes, Expected: 50, Received:
5,................................................ ...........Qty Accepted:
[20], Location: [A20]

He entered the value 20 and selects the location 'A20' using the combo box.

Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
Hi,

Say you have 50 rows in that column there is only one combobox that is displayed when a cell in the column goes into edit mode. If you bind the combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need to clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to
Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations
data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the row that is being edited. You should add each item to the combobox manually. If you bind the data you will wind up changing the values in multiple

rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of
locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row basis.

Can someone help.

Thanks

Doug


Nov 21 '05 #5
Ken,
Sorry the Combo is not bound to the Locations Table.
The Locations Table is the datasource for the Combo Box.

The combo Box is bound to the Location field in the Order Details Table.

Does this make more sense?

"Doug Bell" <dug@bigpond> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl...
Ken,

I am still not sure what you are saying.

My combo box is bound to data not a string list and it is setting the value just for the row that it is displayed within

I already have a datagrid with a combo box.
The Data Grid is bound to the "OrderDetails" Table.
The Combo Box is bound to the "Locations" Data Table.

When I set a value (ie a Location) in the DataGrid using the combo box, it
is setting the selected location for that record (Order Details Line ) only. It is not affecting the other records (Rows) in the data Grid or in the
underlying Data Table ("OrderDetails")!!

I want to know if I can set the bound DataView to filter for the value
within the row rather than setting it as a column style.

Or is there some other way to achieve this result.

Say the datagrid is displaying records filtered for Order No 12345678 and it has 10 lines.

Some of Line 3 might have arrived so the User has to accept say 20 boxes and allocates them to location A20.
He selects row with Line: 3, Item: AA12345, Description: Blue Plastic,
Units: Boxes, Expected: 50, Received:
5,................................................ ...........Qty Accepted:
[20], Location: [A20]

He entered the value 20 and selects the location 'A20' using the combo box.
Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX**************@TK2MSFTNGP12.phx.gbl...
Hi,

Say you have 50 rows in that column there is only one combobox

that
is displayed when a cell in the column goes into edit mode. If you bind

the
combobox you will wind up changing values in rows that arent being edited.
So what you need to do is just before the combobox is displayed you need

to
clear the list and add the filtered items.
Ken
----------------
"Doug Bell" <dug@bigpond> wrote in message
news:uO**************@TK2MSFTNGP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetails" filtered for a
particular OrderNo

The combo box is bounnd to a Data View, "Locations" filtered currently to Locations for a selected Facility.

The Combo Box is to assign a Location to an Order Detail Line.

The Order Detail Line has a field, Warehouse already assigned to it.

What I want to do is to filter the list of Locations in the combo box to
Locations within the particular Warehouse (on the OrderDetail line) as
opposed to the current filter that is for the whole Facility.

I can not work out how to do that as currently I am binding the Locations data to the combo box as part of a custom GridTextBoxStyle set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ep*************@TK2MSFTNGP10.phx.gbl...
Hi,

There is only one combobox for the column that is shown on the

row that is being edited. You should add each item to the combobox manually. If you bind the data you will wind up changing the values in multiple

rows.

Ken
-----------------------
"Doug Bell" <dug@bigpond> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi
I have a datagrid with a combo box,
I need to populate the combo with data dependant on the record value.
eg for record 1, field Warehouse = 2R so combo would allow selection of locations valid for 2R
record 2 has Warehouse = 2M so combo on that row has a selection of
locations valid for 2M

I can set the combo datasource but can't see how to set it on a row by row basis.

Can someone help.

Thanks

Doug



Nov 21 '05 #6
Doug,

You have normally to use a datarelation for that, are you able to do that?

Cor
Nov 21 '05 #7

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

Similar topics

0
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
3
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender,...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
13
by: Saber | last post by:
I did a lot of searches and read something about datagrids. But I couldn't find the answer of my simple question, how can I show only my desired columns of a table? for example I wrote this sql...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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...
0
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
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,...

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.