Script tag in ASPX page is written partially (output stopped at random)

Posted by Nir on Stack Overflow See other posts from Stack Overflow or by Nir
Published on 2010-05-12T13:11:54Z Indexed on 2010/05/12 13:14 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

I have an aspx page where I put a script tag with .net "if" and "else".
The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output.

The code itself (Simplified example):

<body id="body" runat="server">
<form id="form1" runat="server">some HTML
    <script type="text/javascript">
         window.addEvent('domready', function() { 
           var x = "nothing";
           <% if(someCondition){%>
           x = "2";
           <%} else {%>
           x = "3";
           <%}%>
          });
    </script>
</form>
</body>

The cropped output:

<body id="body" runat="server">
    <form id="form1" runat="server">some HTML
        <script type="text/javascript">
             window.addEvent('domready', function() { 
               var x = "nothi
        </script>
    </form>
</body>

Does anybody have a clue?

© Stack Overflow or respective owner

Related posts about c#

Related posts about c#3.5