R
Richard
Hi All,
The ASPX file below runs fine in ASP .NET WebMatrix 0.6 under WinXP/SP2
with IIS 5.1 and .NET Framework 1.0, 1.1 and 2.0.
But if the last scriptString line is eliminated after appending the
closing ">" to the preceding line, the compiler flags that last line in
the browser (Firefox 5.0) with the message:
Compiler Error Message: CS1010: Newline in constant
The same line is flagged immediately in Visual Web Developer 2005 Expr.
Ed., version 8.0.50727.42, with "Newline in constant". VWD also
complains that the final </script> had no matching start tag.
Is this a "universal bug" , or are both caused by a bug in the .NET
C# compiler?
An ideas? Is this too trivial to worry about?
TIA,
Richard
========= ASPX start ===========
<%@ Page Language="c#" %>
<script runat="server">
public void Page_Load(Object sender, EventArgs e) {
// Form the script that is to be registered at client side.
String scriptString = "";
scriptString += "<script language=JavaScript> ";
scriptString += "function DoClick()";
scriptString += "{";
scriptString += " myForm.show.value='Msg from
Btn.DoClick()'";
scriptString += "}";
scriptString += "</script";
scriptString += ">";
if( !this.IsClientScriptBlockRegistered("clientScript") )
this.RegisterClientScriptBlock("clientScript", scriptString);
}
</script>
<html>
<head>
<!-- Directive above not orig. -- added by both WebMatrix & WebDev
2005 EE -->
</head>
<body topmargin="20">
<form id="myForm" runat="server">
<input id="show" style="WIDTH: 200px" type="text" />
<input onclick="DoClick()" type="button" value="ClickMe" />
</form>
</body>
</html>
========== ASPX end ===========
The ASPX file below runs fine in ASP .NET WebMatrix 0.6 under WinXP/SP2
with IIS 5.1 and .NET Framework 1.0, 1.1 and 2.0.
But if the last scriptString line is eliminated after appending the
closing ">" to the preceding line, the compiler flags that last line in
the browser (Firefox 5.0) with the message:
Compiler Error Message: CS1010: Newline in constant
The same line is flagged immediately in Visual Web Developer 2005 Expr.
Ed., version 8.0.50727.42, with "Newline in constant". VWD also
complains that the final </script> had no matching start tag.
Is this a "universal bug" , or are both caused by a bug in the .NET
C# compiler?
An ideas? Is this too trivial to worry about?
TIA,
Richard
========= ASPX start ===========
<%@ Page Language="c#" %>
<script runat="server">
public void Page_Load(Object sender, EventArgs e) {
// Form the script that is to be registered at client side.
String scriptString = "";
scriptString += "<script language=JavaScript> ";
scriptString += "function DoClick()";
scriptString += "{";
scriptString += " myForm.show.value='Msg from
Btn.DoClick()'";
scriptString += "}";
scriptString += "</script";
scriptString += ">";
if( !this.IsClientScriptBlockRegistered("clientScript") )
this.RegisterClientScriptBlock("clientScript", scriptString);
}
</script>
<html>
<head>
<!-- Directive above not orig. -- added by both WebMatrix & WebDev
2005 EE -->
</head>
<body topmargin="20">
<form id="myForm" runat="server">
<input id="show" style="WIDTH: 200px" type="text" />
<input onclick="DoClick()" type="button" value="ClickMe" />
</form>
</body>
</html>
========== ASPX end ===========