1

I'm having a problem getting the syntax correct. The html helper returns true or false.

<% if (<%= Html.SecurityTrim("Admin")%>) { %>  
            <span>Only for accounting</span> 
    <% } %>

What do I need to change to get this to compile correctly?

2 Answers 2

1

Supposing that Html.SecurityTrim() returns bool,

<% if ( Html.SecurityTrim("Admin") ) { %>  
    <span>Only for accounting</span> 
<% } %>
Sign up to request clarification or add additional context in comments.

Comments

1

Sounds like your Html.SecurityTrim() returns a bool.

In this case, then no need to escape out of code, just use it as your condition to test.

<% if (Html.SecurityTrim("Admin")) { %>  
            <span>Only for accounting</span>   
  <% } %>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.