CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 filtering one list box from the selection in another

Print topic Send  topic

Author Message
robn

Posts: 70
Posted: 11/18/2004, 10:09 AM

After looking through many posts I still can't find a resolution to my problem.

What I am trying to do is update a list box depending on the selection of a previous listbox within the same form. So basically when I select a department the from the department listbox the trainee (user) list box is automatically (and instantly) filtered to only show users associated with that department. Just to add a little extra into the equations in order to provide this filter I have to go through 3/4 tables to get the filtered user list. I have written a stored procedure which appears to work fine. It is as follows

Select DISTINCT [ID], FirstName+ ' '+ Surname as username
from tblusers
Inner Join dbo.tblUserGroups on dbo.tblUserGroups.UserID = tblUsers.[ID]
inner join tblTrgDepGroup on tblUserGroups.groupid = tblTrgDepGroup.GroupID
inner join tblTrgDepartment on tblTrgDepGroup.DID = tblTrgDepartment.DID
where tblTrgDepartment.did = ?????
order by username

The problem I have is I need the where clause (???? part) to bring back the integer value stored in the department list box (department.DID). But I can't work out how to pass this parameter through to make it work also I have looked at Java solutions but can't find anything that really helps me.

I am using ASP and SQL
Any help would be much appreciated

regards

Rob
View profile  Send private message
peterr


Posts: 5971
Posted: 11/18/2004, 7:06 PM

Looks like there are several possible solutions:
1. One described at http://support.yessoftware.com/kb_article.asp?article_id=61
1st listbox value is submitted to the server, then the page is refreshed with the 2nd listbox values.

2. One at http://forums.codecharge.com/posts.php?post_id=45962

3. JavaScript-based, which would instantly change the value of the 2nd listbox based on the 1st listbox. There are various examples on the Internet: http://www.google.com/search?hl=en&q=javascript+dependent+listboxes

You may need to evaluate each method and decide which one to use. I suspect that the last one, but I wouldn't know how to implement it. I woud probably find some JavaScript code and then write ASP code that outputs the same JavaScript code.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.