AI OnAI Off
<%#if(container.haschildren && container.currentpage.indent="=" 3) { %>
<% } else { %>
">
<%#container.currentpage.pagename%> (B:<%#container.currentpage.indent%>)%#container.currentpage.indent%>%#container.currentpage.pagename%>
<% } %>
%>%>%#if(container.haschildren>
And so on...
<%# "Some bold text here" %>
Here I just added a element including some text, but from ASPNET's point of view it is only text and does not affect the parent's control collection.
Using the same principle you could do this:
<%# GetSomeValue(Container) %>
and in code-behind:
protected string GetSomeValue(
PageTemplateContainer container)
{
// do whatever...
return "Some HTML here
";
}
You can access the current item's values using the container parameter (container.CurrentPage gets the actual page, for example) and you can generate and return whatever HTML you need in the function.
Just a disclaimer... There are more ways to solve this problem. The above technique is easy to use but a bit ugly, since it generates HTML on the fly without using controls and collections. But it gets the job done.
You can also add all controls to the page and use the Visible property to decide which controls should actually get rendered (controls whos Visible property is false never get rendered).
For example:
The Visible property expects true/false, so the functions above should return booleans.