Question

Is there a way to get the content of a view between curly brackets in a html helper extension, so that I can either display the content or not depending a conditional element. The idea is to test if the user has access to specific content, if so then show inner content, if not then display nothing.

Something along the lines of the Html.BeginForm

<% using(Html.HasAccess()){%>
  <p>You can view the content<p>
<% } %>

I have found lots of examples where you can add tags around content, but none that manipulate the content directly.

Is it possible or is there another way?

Was it helpful?

Solution

Why not just:

<% if (Html.HasAccess()){%>
  <p>You can view the content<p>
<% } %>

?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top