473,701 Members | 2,732 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 1780
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
1994
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 this table.
3
3027
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
4327
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
6829
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 precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
2
10564
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 the form display the values from 1 to the number in the Quantity column (e.g., the selected row has...
3
2999
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
2285
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 relations)?
13
1853
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 datagrid, I get (null) for other ccolumns instead
0
1818
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
8736
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8649
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9229
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9083
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7824
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6571
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4410
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2398
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2035
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.