I have an aspx page with the following code (partial and simplified):
(beginning of page)
<body id="body" runat="server">
<form id="form1" runat="server">some HTML</form>
<script type="text/javascript">
window.addEvent('domready', function() {
var x = "nothing";
<% if(someCondition){%>
x = "2";
<%} else {%>
x = "3";
<%}%>
});
</script>
</body>
Now, the thing is that this script sometime appears in the output, and sometimes not.
It’s not conditional, and supposed to be written every time the page is rendered. Why does it do that?
I’d be happy to get your help.
Thanks!
The solution I found was to move it to the aspx.cs and then register the script. Moving it inside the form didn’t work all the time.