|
|
Subject:
ASP - Dynamic Dropdown Box
Category: Computers > Programming Asked by: krickles-ga List Price: $75.00 |
Posted:
03 Sep 2003 12:30 PDT
Expires: 04 Sep 2003 17:30 PDT Question ID: 251873 |
I need to make dynamic dropdown boxes to embed in a dynamic grid. The grid is working. I have tried two approaches to the dropdown boxes (independent of the grid) to no avail. One approach was straight ASP and the other was ASP & JavaScript. I am using MS SQL Server 2000. Table structure: tbl_product_line product_line_id (numeric, 9, identity) product_line_name (varchar, 50) division_id (numeric, 9) status_id (numeric, 9) date_added (smalldatetime, 4, getdate()) tbl_product_category_lu product_category_id (numeric, 9, identity) product_category_name (varchar, 50) product_line_id (numeric, 9) division_id (numeric, 9) status_id (numeric, 9) date_added (smalldatetime, 4, getdate()) Obviously, the tables are linked on: tbl_product_line.product_line_id = tbl_product_category_lu.product_line_id That being said, I want the first dropdown box to list all values associated with tbl_product_line.product_line_name. The next dropdown box should list all values associated with tbl_product_category_lu.product_catgegory_name filtered on the first choice. Example: Prod_Line dropdown box choices: A, B, C For the second dropdown box: If Prod_Line choice A, then Prod_Cat_Name = prod1, prod2, prod3 If Prod_Line choice B, then Prod_Cat_Name = prod21, prod25, prod36 If Prod_Line choice C, then Prod_Cat_Name = prodC, prod44, prodD My preference is to have all code in ASP and not reload the page. However, time is of the essence and I am open to suggestions. |
|
There is no answer at this time. |
|
Subject:
Re: ASP - Dynamic Dropdown Box
From: mmmurf-ga on 03 Sep 2003 16:32 PDT |
First, write a function to create the first dropdown box. This function should take the relevant id as an argument and print the HTML. Then, write a similar function for the second dropdown box. One way to do this would be to have each function accept as a second argument a string that you will use to name the form code or javascript that you will need to use to handle what happens if the user selects one of the items in the dropdown box. I would probably recommend javascript for this rather than trying to do it all on the server side, since it can be done rather simply with one javascript function that is called when the onchange event fires for one of the dropdown boxes, or the onclick event fires for a button used to navigate based on the selections made. As an alternate approach, you may try doing this using web forms (.net). It has some widgets (datagrids) that are designed to make what you're trying to do very easy and modular. |
Subject:
Re: ASP - Dynamic Dropdown Box
From: chrissandvig-ga on 03 Sep 2003 16:45 PDT |
Here is a nice article that shows the client side JavaScript for conditional dropdown boxes. http://forums.devshed.com/t14074/s.html It should be fairly straightforward to add the data from your database to the html forms. Good luck! Chris |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |