This topic is locked

3 Dropdown to filter

12/10/2008 5:06:08 PM
ASPRunnerPro General questions
F
Flipper author

hi there
i'm using ASPR 5.2
i have a small application where i can upload files and categorize them.
following tables: category, subcategory, filename, date, uploader.
i want to be able to filter on list page with dropdowns: category / subcategory / date / uploader
any tips, tricks, hints are appreciated.
thanks in advance
flipper

J
Jane 12/12/2008

Hi,
use custom event (Insert ASP code snippetoption on the Visual Editortab) to create dropdown on the list page.

Here is just a sample:

categories_list = "<select onchange=""window.location.href=this.options[this.selectedIndex].value;"">"

categories_list = categories_list & "<option value="""">Please select</option>"

str = "select category from " & strTableName

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

while not rstmp.eof

categories_list = categories_list & <option value=""tablename_list.asp?a=search&value=1&SearchFor=" & rstmp("category") & "&SearchOption=Contains&SearchField=category"">" & rstmp("category") & "</option>

rstmp.MoveNext

wend

rstmp.close

set rstmp=nothing
Response.write categories_list

F
Flipper author 12/12/2008

Hi Jane
thanks a lot for the reply and for the example. Unfortunately it doesn't work.

I think I need to rename a few words in the example, in order that it works with my application. I have tried a few things, but without success. Could you please tell me what I need to adapt/rename (I don't know much ASP)?
Looking forward to hearing from you soon. Thanks!
Kind regards
Joe

J
Jane 12/12/2008

Replace all highlighed name with your actual:

categories_list = "<select onchange=""window.location.href=this.options[this.selectedIndex].value;"">"

categories_list = categories_list & "<option value="""">Please select</option>"

str = "select category from " & strTableName

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

while not rstmp.eof

categories_list = categories_list & <option value=""tablename_list.asp?a=search&value=1&SearchFor=" & rstmp("category") & "&SearchOption=Contains&SearchField=category"">" & rstmp("category") & "</option>

rstmp.MoveNext

wend

rstmp.close

set rstmp=nothing
Response.write categories_list


If it doesn't help publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

S
stealthwifi 1/19/2009

Replace all highlighed name with your actual:

If it doesn't help publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.


When adding the code you provided I got a few syntax errors, I added the fixed code below, hope that helps any one else:
[codebox]categories_list = "<select onchange=""window.location.href=this.options[this.selectedIndex].value;"">"

categories_list = categories_list & "<option value="""">Please select</option>"

str = "select category from " & strTableName

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

while not rstmp.eof

categories_list = categories_list & "<option value=""tablename_list.asp?a=search&value=1&SearchFor=" & rstmp("category") & "&SearchOption=Contains&SearchField=category"">" & rstmp("category") & "</option>"

rstmp.MoveNext

wend

rstmp.close

set rstmp=nothing
Response.write categories_list[/codebox]