Hello. last night I was doing some tests on asp.net and I've foud that
if write code like this the page doesn't compile:

<%@ Page Language="C#"  %>
<html >
<head  runat="server">
    <title>Untitled Page</title>
 </head>
<body>
   <script runat="server">
        void ProcessClick( object sender, EventArgs args  )
        {
               string sql = @"<script  language='javascript'>";
               sql += @"alert('";
               sql += nome.Value;
               sql += "');";
               sql += @"</script>"; //ERROR HERE
               this.RegisterClientScriptBlock( "JJ", sql );
       }
       </script>
    <form id="form1" runat="server">
           <input type="text" runat="server" id="nome" />
            <input type="button" runat="server" value="Click me"
id="bt" onserverclick="ProcessClick" />
   </form>
   </body>
</html>

Well, the problem is that the asp.net parser ends the server script tag
when it sees the </script> of the sql variable. I've also posted this in
a local newsgroup and one of its members gave me a workaroud: write sql
+= "<" + @"/script>" instead of what I have written.

Well, what I'd like to know is if this is bug or if this is reported
somewhere.

thanks.

Regards,
Luis

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to