質問

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?

役に立ちましたか?

解決

Why not just:

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

?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top