tags:

views:

39

answers:

2

Hi there..

I have table 'COMPANY' where it keeps all the companies information. In the form, user need to choose their company based on the list provided. My problem now is how can I display the other information that related to the company that have been chosen by the user?

For example, the user choose company ABC. The name of the company will be display in the textfield 'CompanyName'. How can I retrieve the information such as company ABC's address and phone number and display it in the textfield 'CompanyAddress' and 'ContactNo.' ?

Need your help to do this. Thank you.

A: 

Store the company list and information in an associative array (keyed by the company name) in Javascript.

Hook the onchange event of the SELECT element, get the currently-selected option, look for it in your array, and change the value attribute for each of the other fields. If the user should not be modifying the other fields, be sure to mark them read-only.

richardtallent
Hi, is there any codes example available? I'm still new to ASP and javascript. Quite confusing..
A: 

Another option depending on what technologies are available you could have the form repopulate using a asynchronous javascript call.

The basic idea can be seen here: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DropDown/DropDown.aspx

Bob Breznak