correct syntax to exclude tags

  • Thread starter Thread starter Aamir Ghanchi
  • Start date Start date
A

Aamir Ghanchi

Hi,

I need to exclude a control tag from an aspx page depending on the
availability of a session variable.I try to enclose it in an if bloack
as follows, but it seems to be not working.

<% If Session("MySessionVariable") <> "" Then%>
<MyUserCtrl:MyObj id="SearchResultNav" runat="server"></
MyUserCtrl:MyObj>
<% End If%>
simply, I do not want the usercontrol tag to be included on the page
if the session variable is not set.

thanks.
 
It seems that you're thinking in Classic ASP terms here. How about using
the codebehind file to control whether or not it's visible.

codebehind:

SearchResultNav.Visible = Session("MyVariable") <> ""

Ray at work
 
Back
Top