begin process at 2012 05 27 17:13:44
  Trouver un code source :
 
dans
 
Accueil > Forum > 

ASP / ASP3

 > 

Base de données

 > 

Autre

 > 

combo dynamique en cascade


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

combo dynamique en cascade

mercredi 18 juillet 2007 à 16:28:33 | combo dynamique en cascade

Minou77

Bonjour,

Y a t-il une solution pour enchainer plusieur combo (qui vont chercher les données avec un lien ODBC dans une base SQL, ceci ca fonctionne impecable).
Mon problème, je n'arrive pas à garder la valeur de la combo précédente (j' y arrive que sur les 2 premières) tout en restant sur la même page.
Au depart, seul la première combo est visible (normal car les autres se remplissent dynamiquement et avec une requet SQL à chacque fois).
A la fin, lors de la selection de la dernière combo on remplit le tableau suivant).

Mon language est l'asp et l'asp.net (ce code doit être compatible IE6 et Netscape 6).

Je joint le code si cela peut être utile.

<% Option Explicit

Dim Req
Dim NumSite  

%>
<!-- Connexion à la base de donnée -->
<!--#include file="../../../../../connexion_maps02/Conn_maps02.asp"-->
<!--#include file="../../../../../connexion_maps02/adovbs.inc"-->

<script language="javascript">
 
 function Site()
  {
   Site = document.FormAjout.ComboSite.value;
   NumSite = document.FormAjout.ComboSite.value;
   document.general.cache.value = Site;
   document.general.submit();
  }

</script>

<html>
<body>
<form method="POST" name="FormAjout" action="conditions.asp">
 <table border="0" width="234" height="48">
  <%
  'on récupére toutes les sites
  Set req= Conn_maps02.Execute("SELECT distinct nom_etablissement from ba_af_profil")
  NumSite = Request.Form("Cache")
  %>
  <tr>
   <td align="right" width="32" height="44" bgcolor="#33CC33"> Site : </td>
   <td width="95" height="44" bgcolor="#33CC33">
    <p align="left">
    <select onchange="Site()" name="ComboSite">
     <option value="Rien">Choisir Site</option>
          <%
                   'TQ non fin RS
                do while not req.eof
                     Response.write "<OPTION Value="
                       ' récup premier champ
                     Response.write req(0)
                     if NumSite=Req(0) then
                          response.write " SELECTED "
                     end if
                        Response.write ">"
                        Response.write req(0)
                        Response.write "</option>"
                        Response.write vbcrlf
                        req.MoveNext
              loop
              %>
       </select></td>
    <%
    If NumSite <> "" then
     'requete pour les login
      Set req = Conn_maps02.execute("SELECT distinct login, libelle, id_profil from ba_af_profil WHERE nom_etablissement ='" & NumSite & "' ")
     %>
      <td width="42" height="44" bgcolor="#66FF66"><p align="right">Login :</td>
      <td width="47" height="44" bgcolor="#66FF66"><p align="left">
       <SELECT Name="ComboLogin">
        <option value="Rien">Choisir Login</option>
            <%
              'TQ non fin RS
            do while not req.eof
                  Response.write "<OPTION Value="
                    ' récup premier champ
                    Response.write req(2)
                    Response.write ">"
                    Response.write req(0) & " => " & req(1) & " (n° du profile = " & req(2) & ")."
                    Response.write "</option>"
                    Response.write vbcrlf
                     req.MoveNext
            loop
          req.Close
         %>
       </select>
       </td>
    </tr>

   <% end if %>
    </table>
</form>
<FORM method="POST" name="general" action="conditions.asp">
 <input type="text" name="cache" size="20">
</form>
<form method="get" name="resultat" >

<script language="javascript">
 
 function Donnees()
  {
 alert(document.getElementById(ComboSite).options[document.getElementById(ComboSite).selectedIndex].value);
  }

</script>

 <tr>
 </tr>
 <button name="B1"><span lang="fr">Données</span></button>
 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-right-style: solid; border-right-width: 1; border-top-width: 0; border-bottom-style: solid; border-bottom-width: 0; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" bordercolor="#111111" width="1110" id="AutoNumber1">
     <tr>
       <td width="321" style="border-left-style: solid; border-left-width: 1; border-right-style: none; border-right-width: medium; border-top: 1px solid #111111; border-bottom-style: none; border-bottom-width: medium" colspan="5" align="center">
       <span lang="fr">Paramétrage Roulement</span></td>
       <td width="5" style="border-top: medium none #111111; border-bottom-style: none; border-bottom-width: medium" align="center" bgcolor="#CCCCCC">
       <p align="left">&nbsp;</td>
       <td width="291" style="border-top-color: #111111; border-top-width: 1; border-bottom-style: none; border-bottom-width: medium" align="center" colspan="5">
       <span lang="fr">Paramétrage Rame</span></td>
       <td width="17" style="border-top: medium none #111111; border-bottom-style: none; border-bottom-width: medium" bgcolor="#CCCCCC">&nbsp;</td>
       <td width="382" style="border-top-color: #111111; border-top-width: 1; border-bottom-style: none; border-bottom-width: medium" colspan="4" align="center">
       <span lang="fr">Paramétrage immobilisation</span></td>
     </tr>
     <tr>
       <td width="57" style="border-left-color: #111111; border-left-width: 1; border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Rlt</span></td>
       <td width="57" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Consul - tation</span></td>
       <td width="57" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Prévision</span></td>
       <td width="57" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Affec -tation</span></td>
       <td width="57" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Casse Cycle</span></td>
       <td width="5" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" bgcolor="#CCCCCC">&nbsp;</td>
       <td width="51" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Rame</span></td>
       <td width="42" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Série</span></td>
       <td width="59" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Consul - tation</span></td>
       <td width="56" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Prévision</span></td>
       <td width="47" style="border-top-style: none; border-top-width: medium">
       <p align="center"><span lang="fr">Affec -tation</span></td>
       <td width="17" bgcolor="#CCCCCC" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium">&nbsp;</td>
       <td width="64" align="center" style="border-top-style: none; border-top-width: medium">
       <span lang="fr">N° chantier</span></td>
       <td width="202" align="center" style="border-top-style: none; border-top-width: medium">
       <span lang="fr">Nom Chantier</span></td>
       <td width="54" align="center" style="border-top-style: none; border-top-width: medium">
       <span lang="fr">Controle</span></td>
       <td width="85" align="center" style="border-top-style: none; border-top-width: medium">
       <span lang="fr">Création</span></td>
     </tr>
     <!-- Mise en mémoire des entêtes sur le serveur -->
  <tr>
    <td width="57" style="border-left-color: #111111; border-left-width: 1; border-top-style: none; border-top-width: medium; border-bottom-color: #111111; border-bottom-width: 1">&nbsp;</td>
    <td width="57" style="border-top-style: none; border-top-width: medium; border-bottom-color: #111111; border-bottom-width: 1">&nbsp;</td>
    <td width="57" style="border-top-style: none; border-top-width: medium; border-bottom-color: #111111; border-bottom-width: 1">&nbsp;</td>
    <td width="57" style="border-top-style: none; border-top-width: medium; border-bottom-color: #111111; border-bottom-width: 1">&nbsp;</td>
    <td width="57" style="border-top-style: none; border-top-width: medium; border-bottom-color: #111111; border-bottom-width: 1">&nbsp;</td>
    <td width="5" bgcolor="#CCCCCC" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium">&nbsp;</td>
    <td width="51" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="42" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="59" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="56" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="47" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="17" bgcolor="#CCCCCC" style="border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">&nbsp;</td>
    <td width="64" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="202" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="54" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
    <td width="85" style="border-bottom-color: #111111; border-bottom-width: 1; border-top-style:none; border-top-width:medium">&nbsp;</td>
  </tr>
</table>
</form>    
    
</body>
<%Conn_maps02.close%></html>


Merci d'avance pour votre aide.



Cette discussion est classée dans : req, combo, write, response, nbsp


Répondre à ce message

Sujets en rapport avec ce message

gestion d'un panier électronique et d'une commande [ par hightec ] Salut à tous !Voilà je développe un site en asp mais je n'arrive pas à gérer le panier électronique, et la commande.j'ai donc une page qui permet de v afficher des dates nulles de ma base dans 1 page asp ! [ par fil ] BonjourMon problème est simple mais ennuyeux !J'ai une table qui contient un champ date qui peut etre null.Je voudrais afficher tout les champs dans u combo liees avec BD access [ par williams59 ] Bonsoir à tous,J'ai trouvé une excellent exemple ici  même sur ce site de combo liées entre elles. Malheureusement je n'arrive pas à savoir comment ré probléme avec explorateur de fichier [ par gatita_dev ] bonjour,j 'ai traduit la source asp suivant <a href="http://w j'ai besoin d'aide [ par none2502 ] bonjour j'ai un probléme au niveau de l'affichage de ma page , lorsque je clique sur le bouton valider il m'affiche le resultat en bas de la page , ma Roles [ par Poulipe ] Bonjour à tous,je cherche à utiliser les roles pour une authentification windows avec asp 2.0. J ai ajouter dans le web.config :authentication<font co Message d'erreur lors d'une mauvaise identification. [ par groovesalade ] Bonjour, je viens de terminer un site en ASP mais il subsiste une dernière petite erreur. Ce n'est pas important mais j'aimerai bien comprendre :J'ai Acces distant base access FTP [ par fixflys ] Bonjour, Voila, j'ai réussi à faire une page simple qui liste le contenu d'une table d'une base access.J'ai donc 2 fichiers: default.asp et DMM_Data.m comment récupérer des données oracle dans un gridView en mode connecté/deconnecté [ par teentown ] Salut à tous,Je débute en asp.net et j'ai un petit projet à développer.en mode http connexion/ session user /requete sql /deconnexion/ chargement d'un


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,718 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales