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

Easy way to use bound combo with foreignkey id/value on webform?

Okay, I've seen all the examples of using comboboxes on webforms when
using simple values. And in the issue-tracker starterkit there is a way
to use comboboxes with id/value foreign keys in a smart (but hard!)
way.
I think every developer needs bound comboboxes to store foreign
keyvalues while displaying the user-friendly value as it is stored in
the foreign table, so there must be plenty of you that have found a way
to do so...
In a windows form databinding the combo together with using the
DataTextField and DataValueField works. Still not very easy I think but
ok...
Now in a webform I cannot manage to make this work. Still don't know
for sure if this is the easyest way. Found a number of examples on the
Net, but most of the time I think they use too much code. I just need a
simple (quickanddirty way if you want...) to use a bound combo with a
foreign key in it... I did not look to VisualStudio2005 yet, but there
must be a way it can be done in 2003 as well I suppose?

I've had enough of searching for the ultimate example, so please help
if you can.

Nov 19 '05 #1
1 1404
You didn't specify where your data is coming from below uses a SqlDataReader,
ddlTest is a dropdownlist on the web page:

Dim rdr As SqlClient.SqlDataReader =
MyProject.Data.Utilities.GetDataReader("Select ID, Description From
TableName")
ddlTest.DataTextField = "Description"
ddlTest.DataValueField = "ID"
ddlTest.DataSource = rdr
ddlTest.DataBind()
"Adjo" wrote:
Okay, I've seen all the examples of using comboboxes on webforms when
using simple values. And in the issue-tracker starterkit there is a way
to use comboboxes with id/value foreign keys in a smart (but hard!)
way.
I think every developer needs bound comboboxes to store foreign
keyvalues while displaying the user-friendly value as it is stored in
the foreign table, so there must be plenty of you that have found a way
to do so...
In a windows form databinding the combo together with using the
DataTextField and DataValueField works. Still not very easy I think but
ok...
Now in a webform I cannot manage to make this work. Still don't know
for sure if this is the easyest way. Found a number of examples on the
Net, but most of the time I think they use too much code. I just need a
simple (quickanddirty way if you want...) to use a bound combo with a
foreign key in it... I did not look to VisualStudio2005 yet, but there
must be a way it can be done in 2003 as well I suppose?

I've had enough of searching for the ultimate example, so please help
if you can.

Nov 19 '05 #2

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

Similar topics

2
by: Mason Wood | last post by:
I have another question for the community, and hopefully it's an easy one. It seems ridiculously simple, but I can't find anything on it. I have a combo box that is bound to a table. When a...
2
by: CSDunn | last post by:
Hello, I have an MS Access 2003 Project form in which I need to set the value of a textbox named 'TestGrade' to the value present after the update of a combo box currently named 'Combo6'. The data...
2
by: Ed via AccessMonster.com | last post by:
Hi all, What I am trying to do is get the value of the second column of a bound combo box in vba. example: Combo box: column 1-ID column 2-SIGN_CODE 1 R-1.gif 2 ...
3
by: Cindi Simonson | last post by:
Hi, I have a form with a combo box containing 4 columns of data. The form also contains 3 print buttons where the goal is to open 3 different reports according to the value in one of the...
5
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
1
by: James | last post by:
I am used to VB6 but need to develop something in .Net. I need to create several bound combo-boxes which will use lookup tables to get their values. I created a form using the dataform wizard....
1
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .....
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
9
by: Vmusic | last post by:
Hi, I'm using MS Access 2002. I have a form with a combo box built from a query that returns one column, and that one column is the bound column. How do you use VBA to programmatically change...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.