473,569 Members | 2,916 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 1080

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

Similar topics

3
2307
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
2229
by: raj | last post by:
how do i display primary keys, foreign keys that a table has.
1
3809
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 check whether the page looked okay in IE. Then a friend told me that some of my formatting didn't show up, and I'm at a loss as to how to fix it. ...
43
2866
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,* such as the Dale-men make for journeys in the wild,' said the Dwarf. 'So it is,' they answered. 'But we call it *lembas* or waybread, and it is more...
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. It found that the code can be in "code". I put "<meta http-equiv="content-type" content="text/html; charset="utf-8">" in the page. but fail too. I...
0
1491
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 instance. But, my problem arises when I look at foreign keys and advanced relationships. For basic foreign keys, I can just automatically...
6
3826
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 the state/region dropdown when the country changes. However, when my javascript code tries to add the new option and print out new region the...
2
1610
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. What is the definition of "foreign function library"? Is the concept different from a "package"? Is the concept different from a "module"?
2
3427
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 listings. However, I want to display the actual number of records in the dataset that is returned in my HeaderTemplate. I am sure it is very easy to...
1
1477
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 WM_APP+123 for example. -- Elias
0
7693
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
7605
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
8118
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...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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.