Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Dropdown List problem

Hi

i have 3 dropdown list 1 for College list 2nd for Department list and 3rd for Research or events. First i'm getting college name from database and filling it in 1st drop down list box. when i select the anyone of the college i want to fill that college departments in 2nd dropdown list box in same way when i select department i want to fill research/event for the selected college and department.

i have code but it not working properly

like this...

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>


<%
dim rec
public cg_code
Set rec = Server.CreateObject("ADODB.Recordset")
rec.open "select * from college",con,2,2
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




Untitled Document


function college_change()
{
window.location.href="archieve1.asp? fw=ls&cg_code="+document.form1.college.value
}

function dept_change()
{
alert(document.form1.college.value)
alert(document.form1.dept.value)
window.location.href="archieve1.asp?fw=ls&dp_code="+document.form1.dept.value&cg_code="+request.QueryString("cg_code")
}




<%if request.QueryString("fw")="ls" then %>


























<%
if not (request.QueryString("cg_code"))="" and not (request.QueryString("dp_code"))="" then
if rec.state=1 then rec.close
rec.open "select ne_code_in,ne_titile_vc from newsevents where cg_code_in="& request.QueryString("cg_code") & " and dp_code_in="& request.QueryString("dp_code")
response.Write("No.of records =>"& rec.recordcount)
%>













 
 
 
Search
 
      Name of the College
      

---Select College---
<% While (NOT Rec.EOF) %>
" selected=1><%=(Rec.Fields("cg_name_vc"))%>
<%
Rec.MoveNext()
Wend

If (Rec.CursorType > 0) Then
Rec.MoveFirst
Else
Rec.Requery
End If
%>

 
      Name of the Department
      

------Select Department------
<%
if not request.QueryString("cg_code")="" then
if rec.state=1 then rec.close
rec.open "select * from cg_dept where cg_code_in="& request.QueryString("cg_code")

While (NOT Rec.EOF)
%>
" selected=1><%=(Rec.Fields("dp_name_vc"))%>
<%
Rec.MoveNext()
Wend
end if

If (Rec.CursorType > 0) Then
Rec.MoveFirst
Else
Rec.Requery
End If
%>

 
      Event / Research
      

Event
Research

 
      Title
      

<%
while not rec.eof
%>
" selected> <%=rec.fields("ne_title_vc")%>
<%
rec.movenext
wend
end if
%>


 


 
 
 
<% end if %>



<%
Rec.Close()
Set Rec = Nothing
%>


Thanks your help for me guys

Jai Sankar N


Sign In or Register to comment.