I'm trying to do the following in a aspx page:
<%@ Page Language="C#" EnableSessionSTate="true" ValidateRequest="False" Inherits="MyProject.CodeBehind.MYWF.SiteWF" MasterPageFile="~/_layouts/application.master" %>
<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderPageDescription" runat="server">
<% if (!isOld) %>
<% { %>
<p>display this</p>
<% } %>
</asp:Content>
isOld is a public bool variable from the cs file mentioned in the namespace.
But unfortunately it gave me an unknown error.
I could do something similar in JSPs, but after googling around for a while, I'm not so sure whether the above is achievable in ASP.NET? (Am I missing a tag declaration, or do I have to write the entire tag lib myself?)
Thanks.
EDIT: I just got an unknown error. I have a feeling that the code above has either the wrong syntax or are totally off the wrong track. I tried the following code, and there was no error, but the bool variable is always false:
<% #if !isOld %>
<p> display this</p>
<% #endif %>
PlaceHolderand set it'sVisibleproperty appropriately (this is what I would do).<% if (!isOld) %>should be<% if (!isOld) { %>(note bracket). (Edit: actually, perhaps not, I've never seen anyone write the bracket in a totally different<% %>area though, it seems odd ..