begin process at 2008 08 29 01:43:15
1 233 478 membres
20 nouveaux aujourd'hui
14 291 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : 2 listes (menu) en asp (dynamique) [ Base de données / SQL Server ] (edgarandregalan)

2 listes (menu) en asp (dynamique) le 11/07/2006 20:48:47

edgarandregalan

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&#233;l&#233;ctionnez ->>></option>
                <option <% If strCalendrier = "ac" Then %>selected<% End If %>>Ann&#233;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&#233;l&#233;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
   



Classé sous : calendrier, and, format, now, mois

Participer à cet échange

Pub



Appels d'offres

Recherche developpeur ...
Budget : 700€
SITE MARCHAND LOCATION...
Budget : 3 000€
SITE MARCHAND POUR HOTEL
Budget : 4 000€

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

VS Express FR Gratuit !

VS Express en français et 100% gratuit !

Téléchargements

Logiciels à télécharger sur le même thème :

Boutique

Boutique de goodies CodeS-SourceS