title: Function call from aspx design time error "name does not exist in the current context"
body: <p>I want to change the styles of certain elements on my page depending on the role of the logged in user.</p>
  
  <p>To achieve this, I'm calling a function to execute some server code that does the evaluation and returns a string being the name of the style rule:</p>
  
  <pre><code>&lt;li class="&lt;%=CheckAllowed("admin"); %&gt;"&gt;
  </code></pre>
  
  <p>In my code file I have the following:</p>
  
  <pre><code>public string CheckAllowed(string role)
  {
      if (HttpContext.Current.User.IsRole(role))
      {
          return "visible-menu-item";
      }
      else
      {
          return "hidden-menu-item";
      }
  }
  </code></pre>
  
  <p>The function name in the markup is underlined red with the following error:</p>
  
  <blockquote>
    <p>The name 'CheckAllowed' does not exist in the current context.</p>
  </blockquote>
  
  <p>Am I calling the function correctly? If not, how would this be done correctly?</p>