Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
Please any one help below requirements. It would be very useful for me . Advance Thanks

I have a datas in sql database table. I want to display the values in dropdown list,
for example I have three dropdown list in form , If I click values in first dropdown list. automaticaly respective values to show the second in drop down list .
then click second dropdown list automaticaly respective values to show the thord in drop down list..

My code is below
XML
<body>
ON ERROR RESUME NEXT
dim rs,sql,rs1,sql1
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "select distinct dvn_cd,dd from sidhsc3 order by DD asc", con,2,3
%>
<form method="POST" action="lsasupdate.asp" name="form1" id="form1" onSubmit="return autosubmit()">
</font>
<table>
<tr>
    <td width="22%" ><b>Name of the HUD</b></td>
    <td width="28%" >
      <select size="1" name="hud" id="hud">
        <option value="">--Select District--</option>
        <%
            do while not rs.eof
        %>
        <option value="<% =rs("dd") %>">
          <% =rs("dd") %>
        </option>
        <%
            rs.movenext
            loop
            rs.close
        %>
      </select>
   </td>
</tr>
  <tr>
            <td <b>Block Name</b></td>
            <td width="16%" >
                   <font face="Arial, Arial, Helvetica">

                    <select size=1 name="block1" id="block1" class="select" value="--Select Block--">
                    <option value="">---Select Block---</option>

                    <%  response.Write("<br>")
                        set rs=Server.CreateObject("ADODB.Recordset")
                        sql="select distinct bl_cd,bk from sidhsc3 order by bk asc"
                        rs.open sql, con,2,3
                        do while not rs.eof
                    %>
                    <option value=<% =rs("bk")%>><%=rs("bk")%></option><br />
                    <%
                        rs.movenext
                        loop
                        rs.close
                    %>
                    </select>
             </td>
  </tr>
  <tr>
            <td> <b>PHC Name</b></td>
<td width="84%" >
                    <select size=1 name="phc1" id="phc1" >
                    <option value="">---Select PHC---</option>

                    <%
                        set rs=Server.CreateObject("ADODB.Recordset")
                        sql="select distinct phc_cd,phc from sidhsc3 order by phc asc"
                        rs.open sql, con,2,3
                        do while not rs.eof
                    %>
                    <option value=<% =rs("phc") %>><% =rs("phc")%></option><br />
                    <%
                        rs.movenext
                        loop
                        rs.close
                    %>
                    </select>           </td>
          </tr>
</table>
<font face="Arial, Arial, Helvetica">
<p align="center">
<input type="button" value="Back" name="back" onClick="history.go(-1)" style="font-family: Times New Roman; font-weight: bold; border-style: groove">
<input type="Submit" value="Submit" name="Submit" tabindex="12" style="font-family: Times New Roman; font-weight: bold; border-style: groove">
</form>
</font>
</body>



In the above code successfully i got the values from the database table to respective dropdowns but i dont know to fillter the dropdown list code...
Please anyone help me...

I want only classic asp dont want asp.net.....
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900