How to access view content between curly brackets in a helper extension

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?

Answers


Why not just:

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

?


Need Your Help

How to call or update from a function?

vb.net

I have a asp.net VB code to insert draft/saved messages into a a new table created for draft messages database. I want to check if the the record exists before it is saved. So I have made a function