Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Drop Down Menu based on session value 1

Status
Not open for further replies.

robbie59

Technical User
May 9, 2001
36
US
I am using a session to allow viewing of a page as follows

<%If lcase(Session(&quot;Accesslevel&quot;)) = &quot;&quot; Then
Response.redirect &quot;./login.asp?Redirect=&quot; &Request.Servervariables(&quot;URL&quot;)
End if%>
I also have a drop down menu I would like to hide unless the session value is % this is so admins can see recordsets based on this session value. the drop down code is as follows:

<select name=&quot;tranid&quot; id=&quot;tranid&quot;>
<option value=&quot;%&quot;>All</option>
<%
While (NOT RSTranscriptionist.EOF)
%>
<option value=&quot;<%=(RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value)%>&quot;><%=(RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value)%></option>
<%
RSTranscriptionist.MoveNext()
Wend
If (RSTranscriptionist.CursorType > 0) Then
RSTranscriptionist.MoveFirst
Else
RSTranscriptionist.Requery
End If
%>
</select>

I have tried response.write with if statements but keep getting errors any Ideas on how to hide the menu unless session value = %




If knowledge were power I would be a AAA battery!
 
<%
If rtrim(Session(&quot;Accesslevel&quot;)) = &quot;%&quot; Then
response.write &quot;<select name=&quot;&quot;tranid&quot;&quot; id=&quot;&quot;tranid&quot;&quot;>&quot;

While (NOT RSTranscriptionist.EOF)

response.write &quot;<option value='&quot; &_
RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value) &_
&quot;'>&quot; & RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value)

RSTranscriptionist.MoveNext()
Wend
response.write &quot;</select>
end if
%>

?

hth,
Foxbox
ttmug.gif
 
Now I get this error with that code, Sorry as you can tell I am new to asp programming
Error:



RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value) &_
-------------------------------------------------^


If knowledge were power I would be a AAA battery!
 
sorry: i accidentaly removed some ( 's

hth,
Foxbox
ttmug.gif
 
Where from?

If knowledge were power I would be a AAA battery!
 
your post:
Code:
            <option value=&quot;<%=(RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value)%>&quot;><%=(RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value)%></option>


i wrote:
Code:
response.write &quot;<option value='&quot; &_
   RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value) &_
   &quot;'>&quot; & RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value)


leaving out some ('s


try:
Code:
response.write &quot;<option value='&quot; &_
   RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value &_
   &quot;'>&quot; & RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value
leaving out some )'s ! [rednose]

hth,
Foxbox
ttmug.gif
 
Thanks that works great but I am missing the All selection at the top of the menu list I tred putting in the
<option value=&quot;%&quot;>All</option>
but I keep making it error out when I insert it. Thanks again for all your help..


If knowledge were power I would be a AAA battery!
 
Code:
<%
If rtrim(Session(&quot;Accesslevel&quot;)) = &quot;%&quot; Then
 response.write &quot;<select name=&quot;&quot;tranid&quot;&quot; id=&quot;&quot;tranid&quot;&quot;>&quot; &_
 &quot;<option value=&quot;&quot;&quot; & chr(37) & &quot;&quot;&quot;>All&quot;

 While (NOT RSTranscriptionist.EOF)

  response.write &quot;<option value='&quot; &_
   RSTranscriptionist.Fields.Item(&quot;lRecordID&quot;).Value &_
   &quot;'>&quot; & RSTranscriptionist.Fields.Item(&quot;Name&quot;).Value

   RSTranscriptionist.MoveNext()
 Wend
response.write &quot;</select>
end if
%>


(ascii 37 = %)



hth,
Foxbox
ttmug.gif
 
Thanks that worked Great! Guys Like you are like the fireman of the programming world by pull people's butts out of a tight spot....


Thank again

If knowledge were power I would be a AAA battery!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top