473,545 Members | 529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1772
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******** *******@TK2MSFT NGP10.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, "OrderDetai ls" 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 GridTextBoxStyl e set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ep******** *****@TK2MSFTNG P10.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******** *******@TK2MSFT NGP10.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******** ******@TK2MSFTN GP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetai ls" 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 GridTextBoxStyl e set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ep******** *****@TK2MSFTNG P10.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******** *******@TK2MSFT NGP10.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 "OrderDetai ls" 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***@bellsout h.net> wrote in message
news:OX******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetai ls" 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 GridTextBoxStyl e set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ep******** *****@TK2MSFTNG P10.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******** *******@TK2MSFT NGP10.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******** ******@TK2MSFTN GP12.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 "OrderDetai ls" 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***@bellsout h.net> wrote in message
news:OX******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP15.phx.gbl...
Hi Ken,
I am not following.

The Data Grid is bound to a Data View, "OrderDetai ls" 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 GridTextBoxStyl e set up.

Thanks Doug

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ep******** *****@TK2MSFTNG P10.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******** *******@TK2MSFT NGP10.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
1984
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 populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show...
3
3017
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 download a fully working C# sample with the Northwind.mdb here: www.insightgis.com.au/web/stuff/DataGridCombo.zip
2
4322
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 how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
3
6811
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: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more...
2
10560
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 several columns, the last of which (with the header Quantity) contains int16 values. When a user selects a row, I would like to have a combobox on...
3
2989
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, System.EventArgs e) {try{ DataSet ds = dgMembers.DataSource as DataSet;
4
2266
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 combobox in a datagrid? Any other suggestions/articles on how to implement many-many relations in the frontend (which of course are 2 one-many...
13
1843
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 query: OleDbDataAdapter1.SelectCommand.CommandText = & _ "Select illNameE From tblIllness" OleDbDataAdapter1.Fill(DsIllness1) But in my...
0
1806
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 the same row when user change the value of one of the combo box. The textbox value in the same row could be changed by modifying the
0
7465
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...
0
7398
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...
0
7752
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...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
701
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...

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.