Pergunta

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?

Foi útil?

Solução

Why not just:

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

?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top