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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top