Way to avoid server code in .ASPX

2007-03-28
2013-05-28
  • Tobin Zerba
    Tobin Zerba
    2007-03-28

    I'm getting lots of errors when validating server code in an ASPX file.  Here's a sample:

    edit.aspx
    edit.aspx(15): SyntaxError: syntax error
            <% =RenderInitCalendar() %>

    Code inside <% %> blocks should be ignored.  I imagine there's a similar problem with PHP as well.

    Is there a way to get JSL to ignore this type of declaration?

     
    • No, JavaScript Lint has no way to do this right now. I'm not familiar with this syntax. Are you doing something like this?

         <script>
         var x = <% =GetMyNumber() %>;
         </script>

         <script>
         var x = <?php echo $x; ?>;
         </script>

      Could you provide me with a little more context for your code snippets?

       
  • I'm getting lots of errors when validating server code in an ASPX file. Here's a sample:

    <script runat="server">
    //the folwings are CSharp Code and JSL assumes it is JavaScript. so i get SyntaxError: protected is a reserved identifier
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {
        if (!ServiceFactory.GetAuthenticationService().GetCurrentUser().IsAdministartor)
        {
           throw new Exception("Access is denied");
        }
      }
    }

    </script>

     
  • It was reasonable even if the /*jsl:ignoreall*/  and/or  /*jsl:ignore*/ do solve this problem. unfortunately it doesn't help me. :)