PDA

View Full Version : Hide a ListBox?


cdene
06-01-2005, 08:33 PM
How do I hide a list box based on the session userID?

Thank You

JimB
06-01-2005, 08:39 PM
IF NOT Session("userID") = (id) THEN
'Display List Box
END IF

miranda
06-01-2005, 10:22 PM
JimB's response works in classic asp if you need to know how to do it in asp.Net you would just change the visible attribute of the listbox to false. like so
If Not Session("userID") = (id) Then listbox1.visible = false
or
If Not User.Identity.Name = (id) Then listbox1.visible = false

now if you want to see if the session variable has a value assigned to it and then display the listbox (or hide it if no value)

'classic asp
If Not Session("userID") = "" Then
'display listbox
End IF

'asp.net
If Session("userID") = "" Then listbox1.visible = false
or
If User.Identity.Name = "" Then listbox1.visible = false