Question:
J'ai 2 listes (menu)
1ere : Calendrier--------> contient les options suivantes :
Année en cours
Mois en cours
Mois prochain
3 prochains mois
Les valeurs du menu est dans un table d'une bd (Access) en format : Date, abrégé
2eme liste : région -----> qui doit être vide tant qu'il n'y a pas de sélection dans le calendrier.
Lorsqu'il y a une option sélectionnée dans le calendrier,
Les Menus (région) affichent dynamiquement ses options selon l'option sélectionnée du calendrier
Comment je peux faire en ASP ?
détails :
J'ai 2 listes (menu)
1ere : Calendrier--------> contient les options suivantes :
Année en cours
Mois en cours
Mois prochain
3 prochains mois
Le champ de ma table nommé : dateDebut
Format : Date, abrégé
Qui contient que le date comme : 2006-08-22
Voici le code (en ASP) sans connexion à la table :
<select name="DATEDEBUT">
<option>Séléctionnez ->>></option>
<option <% If strCalendrier = "ac" Then %>selected<% End If %>>Année en cours</option>
<option <% If strCalendrier = "mc" Then %>selected<% End If %>>Mois en cours</option>
<option <% If strCalendrier = "mp" Then %>selected<% End If %>>Mois prochain</option>
<option <% If strCalendrier = "3pm" Then %>selected<% End If %>>3 prochains mois</option>
</select>
2eme : région -----> qui doit être vide tant qu'il n'y a pas de sélection dans le calendrier.
Lorsqu'il y a une option sélectionnée dans le calendrier,
Les Menus (région) affichent dynamiquement ses options selon le calendrier
Le champ de ma table nommé : Région
Format : Date, abrégé
Voici le code :
<select name="REGION">
<option>Séléctionnez ->>></option>
<%
strSQL = "SELECT DISTINCT Region FROM EVENEMENTS order by Region"
objRS.activeconnection=objConn
objRS.open strSQL
domaine = ""
Do While Not objRS.EOF
Response.Write ("<option value='" & objRS("REGION") & "'")
If cInt(strRegion) = objRS("REGION") Then
Response.Write(" selected")
End If
Response.Write(">" & objRS("REGION") & "</option>" & chr(13))
objRS.MoveNext
Loop
%>
</select>
voici le bloc du code :
<%
If strCalendrier <> "" then
strSQL = "SELECT *" _
& "FROM EVENEMENTS " _
& "WHERE dateDebut >= debutPeriode" _
& "AND dateDebut <= finPeriode"
If strCalendrier = "ac" then
filtreDate = " and dateDebut between #" & Format(CDate(now().year & "/01/01" ),"dd/MM/yyyy") & "# and #" & Format(CDate(now().year+1 & "/01/01" ),"dd/MM/yyyy") &"#"
End If
If strCalendrier = "mc" then
filtreDate = " and dateDebut between #" & Format(CDate(now().year & "/" & now().Month & "/01" ),"dd/MM/yyyy") & "# and #" & Format(CDate(now().year & "/" & now().Month+1 & "/01" ),"dd/MM/yyyy") &"#"
End If
If strCalendrier = "mp" then
filtreDate = " and dateDebut between #" & Format(CDate(now().year & "/" & now().Month+1 & "/01" ),"dd/MM/yyyy") & "# and #" & Format(CDate(now().year & "/" & now().Month+2 & "/01" ),"dd/MM/yyyy") &"#"
End If
If strCalendrier = "3pm" then
filtreDate = " and dateDebut between #" & Format(CDate(now().year & "/" & now().Month & "/01" ),"dd/MM/yyyy") & "# and #" & Format(CDate(now().year & "/" & now().Month+3 & "/01" ),"dd/MM/yyyy") &"#"
End If
Set rstSearch = Server.CreateObject("ADODB.Recordset")
rstSearch.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText
Response.Write("<td class='arial_10' nowrap>" & rs("DATEDEBUT") & "</td>")
Response.Write("<td class='arial_10' nowrap>" & rs("REGION") & "</td>")
%>
(...)
<%
rstSearch.Close
Set rstSearch = Nothing
End If
End If
objRS.Close
Set objRS = Nothing
objRS2.Close
Set objRS2 = Nothing
objConn.Close
Set objConn = Nothing
%>
</body>
</html>
_|__|__
{?_°}
0000