Ho scritto così, ma il valore seelzionato nella prima select centro si perde quando si attiva l'evento onchange della seconda select tipo.
codice:
<%
Function SELECTED(firstVal, secondVal)
If cSTR(firstVal) = cSTR(secondVal) then
SELECTED = " SELECTED"
End If
End Function
SQL = "SELECT * FROM ... "
Set rec = Server.CreateObject("ADODB.Recordset")
rec.Open sql, cn
if not rec.eof then
%>
<select size="1" name="Centro" class="ctrl">
<option value="">Seleziona</option>
<%
rec.MoveFirst()
Do While Not rec.EOF
%>
<% if request.querystring("Centro") <> "" then %>
<option value="<%=Centro%>"<%=SELECTED(Centro, request.querystring("Centro"))%>>
<%=Centro%></option>
<% else%>
<option value="<%=rec("Centro")%><%=rec("Centro")%></option>
<% end if %>
<%
rec.MoveNext()
Loop
end if
rec.Close()
set rec = Nothing
%>
</select>
<%
SQL = "SELECT * FROM... "
Set rec = Server.CreateObject("ADODB.Recordset")
rec.Open sql, cn
if not rec.eof then
%>
<select size="1" name="tipo" class="ctrl" onChange="window.location='index.asp?Centro=<%=Centro%>&tipo='+this.options[this.selectedIndex].value;">
<option>Seleziona</option>
<%
rec.MoveFirst()
Do While Not rec.EOF
%>
<option value="<%=rec("TIPO")%>"<%=SELECTED(rec("TIPO"), request.querystring("tipo"))%>>
<%=rec("TIPO")%></option>
<%
rec.MoveNext()
Loop
end if
rec.Close()
set rec = Nothing
%>
</select>