473,503 Members | 9,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to display Foreign-Key Name fields in edit mode of data contro

I've got a relatively simple scenario that I haven't been able to solve in
ASP 2.0.

Let's assume I have a simple foreign key relationship as demonstrated below:

------------------- -----------------------------
| States | | Customers |
------------------- ----------------------------
| ID | Name | | ID | Name | Location |
-------------------- -----------------------------
| 1 | Alabama | | 1 | Bob | 3 |
| 2 | Alaska | | 2 | Joe | 2 |
| 3 | Arizona | | 3 | Jill | 1 |
| n | ... | | n | .... | ... |
-------------------- -----------------------------

Now, let's assume I want a webform to display (or allow editing) a list of
customers with a DataGrid or similar control.

I have NOT been able to figure out a way in ASP 2.0 to have the name field
in the foreign key table to display the state name.
For viewing, this is easily overcome by designing a query that contains
performs the appropriate join and then display that column... but what if I
want to edit?

In edit mode, I would still like to display the state name (in a
DropDownList of all states) and use that in performing the edit/update. I
can't find a way to do this.

In ASP 1.1 this way relatively easy - You could use a DataList and bind the
List to an SQLDataAdapter containing the "Customers" table and have a second
SQLDataAdapter containing the States table. For the DropDownList in edit
mode, you could override the default binding and bind the DataTextField and
DataValueField properties seperately to the full list of states in the second
SQLDataAdapter.

This should be an incredibly common and simple task - displaying a lookup
for a foreign key - but I haven't gotten it to work vis-a-vis editing data,
and this has been embarassing.

Any help or suggested links are appreciated.

- Jonathan
Nov 19 '05 #1
0 1069

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

Similar topics

3
2304
by: Jeff Napier | last post by:
Hi, This works: banner = getImage(GetCodeBase(),"mypicture.jpg") But, I tried variations of: try { url = new URL("http://www.my-other-website.com/mypicture.jpg");
1
2219
by: raj | last post by:
how do i display primary keys, foreign keys that a table has.
1
3804
by: Arthaey | last post by:
I use Mozilla 1.4a almost exclusively for my general browsing needs. I'm working on a blog and am playing around with CSS a bit. Things were looking quite nice in Mozilla, and I didn't think to...
43
2850
by: David Trimboli | last post by:
In a text, I might want to include a foreign language term. In print, this is typically shown with italics. For instance (asterisks represent italics): 'I thought it was only a kind of *cram,*...
1
2153
by: Tommy | last post by:
I use MSSQL2000 with nvarchar to store foreign language e.g. Simplified Chinese or Japanese and thse records can be well displayed via Query Analyzer. Now, using asp to select record and display....
0
1483
by: Carl Vondrick | last post by:
Hi everyone, I am having trouble wrapping my mind around the ActiveRecord pattern and foreign keys. I understand that for each table, there should be a class, and each row is is effectively an...
6
3819
by: Melissa | last post by:
Initially the form is loaded using ASP and HTML and the ü codes display the characters correctly. I have the values stored in a javascript array so that I can more easily and dynamically change...
2
1607
by: mirandacascade | last post by:
I am prompted to make these inquiries after seeing the following link to ctypes: http://docs.python.org/lib/module-ctypes.html in which ctypes is described as a foreign function library. ...
2
3422
by: rpeacock | last post by:
I am using a repeater to display a list of properties that I am pulling from my database. I am very new to ASP.NET so this is still a bit foreign to me. The repeater is working great for my...
1
1475
by: news.microsoft.com | last post by:
Hello How can I write a C# Windows Forms application so that it tells if it receives foreign windows messages. Foreign, say something like when another application takes its HWND and issues a...
0
7193
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
7067
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...
0
7316
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...
1
6975
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
7449
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...
1
4992
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...
0
4666
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...
0
1495
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 ...
0
371
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...

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.