Dynamic List - Vehicle Selection

Year ManufacturerVehicle
Dynamic List - Vehicle Search
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim Trigger As Boolean = (InStr(1, Request.QueryString("ASPdbDList_Trigger"), "True", 1) > 0 AndAlso Left(Request.Form("ASPdbDlistSubmit"), 1) <> "[")
  Dim i As Integer
  Dim spic As String = "<Table border=0 width=600><tr><td valign=middle align=center colspan=3><IMG SRC='/tornado/db/images-car/hummer.jpg'></td></tr></Table>"
  Dim dy6 As New tornado.z()
  With dy6
    .dbQP = "U=65| S=gold| D=car2000.mdb|Th=tit=Dynamic List - Vehicle Selection"
    Dim InTemplate As String = "<Center><table width=600><tr><td valign=top><span class=Ch>Year</span>[[Level0]]</td><td valign=top><span class=Ch>Manufacturer</span>[[Level1]]</td><td valign=top><span class=Ch>Vehicle</span>[[Level2]]</td></tr></table>"
    If Not Trigger Then InTemplate &= spic
    .dbDynalist = "InputHtml=" & InTemplate & ";Level=0|Label=[Select a Year]|SQL=SELECT DISTINCT Yr FROM Carspecs;Level=1|Label=[Select a Manufacturer]|SQL=SELECT DISTINCT Manufacturer FROM Carspecs WHERE Yr = '{{0}}';Level=2|Tag=Single Size=Max|Label=[Select Vehicle]|SQL=SELECT Car FROM Carspecs WHERE Yr = '{{0}}' and Manufacturer = '{{1}}'"
  End With

'------------- Trigger Display Code ---------------------
  If Trigger Then
    Response.Write("<table border=0><tr><td align=center valign=top class=R2 colspan=3>")
    Dim SelCar As String = Request.Form("ASPdbDlistSubmit")
    Dim Car As New tornado.z()
    Car.dbQP = "U=56|nh=true|M=Form|D=Car2000|mts=-1|fmtp=file=/tornado/templates/AutoSales/_CarDisplayTemplate.html"
    Car.dbSQL = "SELECT * FROM Carspecs WHERE Car = '" & SelCar & "'"
    Car.dbFormMagicCell = "fi=Price|macro=#Price::Currency#,fi=Picture|macro=<IMG SRC='/tornado/DB/images-car/#picture#'>"
  End If
End Sub

This example illustrates a very common application - drill down search. The feature is pre-packaged and is ready to use by substituting the values of the search levels.

Send comments on this topic.
Copyright (c) 1998-2006 ASP-db