Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:48
Session Variables not being read
Poster: bdaltilio
Dated: Tuesday November 14 2006 - 16:38:18 GMT
I have a menu that is not reading the session variables. I know the session variables are there because I did a response write on the asp page before and after I call the menu and they do print.
Here is part of the asp menu data I am using, the session variable is Session("Region")
Code:
with(milonic=new menuname("contact")){
style=menuStyleSub;
aI("text=Locate a Sales Manager;url=/contact/locate_sales_manager.asp;status=Locate a Sales Manager");
aI("text=Locate a Distributor;url=/contact/locate_distributor.asp;status=Locate a Distributor");
<%
set adoConn = server.createobject("adodb.connection")
set adoRS = server.createobject("adodb.recordset")
adoConn.Open application("conn_ConnectionString")
sSQL = ""
sSQL = sSQL & "SELECT DISTINCT CT.Name, CT.ctID, ISNULL(CT.dspOrder, '99999') dspOrder FROM Contacts AS C "
sSQL = sSQL & "JOIN ContactType AS CT ON CT.ctID = C.ctID "
sSQL = sSQL & "WHERE C.RegionID = " & Session("Region") & " "
sSQL = sSQL & "OR C.RegionID = 0 "
sSQL = sSQL & "ORDER BY dspOrder, CT.NAME"
set adoRS = adoConn.Execute(sSQL)
IF NOT adoRS.EOF THEN
Do Until adoRS.EOF
%>
aI("text=<%=adoRS("Name")%>;url=/contact/?id=<%=adoRS("ctID")%>&r=<%=Session("Region")%>;status=<%=adoRS("Name")%>;");
<%
adoRS.MoveNext
Loop
END IF
adoRS.Close
adoConn.Close
sSQL = ""
%>
}
style=menuStyleSub;
aI("text=Locate a Sales Manager;url=/contact/locate_sales_manager.asp;status=Locate a Sales Manager");
aI("text=Locate a Distributor;url=/contact/locate_distributor.asp;status=Locate a Distributor");
<%
set adoConn = server.createobject("adodb.connection")
set adoRS = server.createobject("adodb.recordset")
adoConn.Open application("conn_ConnectionString")
sSQL = ""
sSQL = sSQL & "SELECT DISTINCT CT.Name, CT.ctID, ISNULL(CT.dspOrder, '99999') dspOrder FROM Contacts AS C "
sSQL = sSQL & "JOIN ContactType AS CT ON CT.ctID = C.ctID "
sSQL = sSQL & "WHERE C.RegionID = " & Session("Region") & " "
sSQL = sSQL & "OR C.RegionID = 0 "
sSQL = sSQL & "ORDER BY dspOrder, CT.NAME"
set adoRS = adoConn.Execute(sSQL)
IF NOT adoRS.EOF THEN
Do Until adoRS.EOF
%>
aI("text=<%=adoRS("Name")%>;url=/contact/?id=<%=adoRS("ctID")%>&r=<%=Session("Region")%>;status=<%=adoRS("Name")%>;");
<%
adoRS.MoveNext
Loop
END IF
adoRS.Close
adoConn.Close
sSQL = ""
%>
}
Can someone tell me what is going wrong?
Poster: kevin3442
Dated: Wednesday November 15 2006 - 4:19:31 GMT
Hmmm. Looks OK to me at first glance. Are the other values in the aI() string getting set properly from your record set? Have you tried using the Session.Contents() syntax? (Not that it should make a difference... just throwing out random thoughts.)
Try a js test. Stick an alert in your javascript code, sort of like:
Code:
alert("--" + <%=Session("Region")%> + "--");
Does the session variable show in the alert box?
Kevin
Industrial Strength JavaScript and DHTML Menus
About Us
Testimonials
Contact Us
Our Distinguished Clients
Investing in Non-Profits
Where Are We
Privacy Policy
Software Licensing Agreement
DHTML JavaScript Menu
Product Information
Page Integration
Quick Reference Guides
Embedding Into a Table or DIV
Purchase
