[Mono-bugs] [Bug 48592][Nor] New - error rendering aspx/ascx with javascript inside
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 18 Sep 2003 04:01:34 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by nicorac@yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=48592
--- shadow/48592 2003-09-18 04:01:34.000000000 -0400
+++ shadow/48592.tmp.13046 2003-09-18 04:01:34.000000000 -0400
@@ -0,0 +1,136 @@
+Bug#: 48592
+Product: Mono/Runtime
+Version: unspecified
+OS: Mandrake 9.1
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: nicorac@yahoo.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: error rendering aspx/ascx with javascript inside
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. create an ascx control or an aspx page containing two <asp:textbox>
+named txtUsername and txtPassword, with an <asp:linkbutton> named cmdLogin
+
+2. insert this script in control/page body
+<script language="JavaScript"> <!--
+
+ // keypress handler function
+ function TextBoxKeyHandler(evt) {
+ var usr = document.getElementById('<%=
+txtUsername.ClientID %>');
+ var pwd = document.getElementById('<%=
+txtPassword.ClientID %>');
+ var keyCode = evt ? (evt.which ? evt.which :
+evt.keyCode) : event.keyCode;
+
+ if (keyCode == 13)
+ if (usr.value != '')
+ if (pwd.value == '')
+ pwd.focus();
+ else
+ <%= Me.Page.GetPostBackClientEvent
+(cmdLogin, "") %>;
+ }
+
+
+ // sets up key detection event
+ if (document.layers) document.captureEvents(Event.KEYPRESS);
+ document.onkeydown = TextBoxKeyHandler;
+
+--> </script>
+
+
+3. when then page gets compiled the error reported is this
+/tmp/tmp1b2e6182.cs(236,0) : error CS0103: The name `txtUsername.ClientID'
+could not be found in `ASP.ctrlSignIn_ascx'
+/tmp/tmp1b2e6182.cs(240,0) : error CS0103: The name
+`Me.Page.GetPostBackClientEvent' could not be found in
+`ASP.ctrlSignIn_ascx'
+
+and the listing is this:
+Line 228: private void __RenderTree(System.Web.UI.HtmlTextWriter
+__output, System.Web.UI.Control parameterContainer) {
+Line 229: __output.Write("\n\n<P>\n\t<TABLE id=\"tblSignIn\"
+cellSpacing=\"0\" cellPadding=\"0\" bgColor=\"#ffffff\" border=\"0
+\">\n\t\t<TR>\n\t\t\t<TD width=\"6\" background=\"/images/Login_SE.gif\"
+height=\"6\"></TD>\n\t\t\t<TD width=\"180\"
+background=\"/images/Login_HT.gif\"></TD>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_SW.gif\"></TD>\n\t\t</TR>\n\t\t<TR>\n\t\t\t<TD
+width=\"6\" background=\"/images/Login_VL.gif\" height=\"26
+\"></TD>\n\t\t\t<TD align=\"center\" width=\"180\" bgColor=\"#ccffff\"
+height=\"26\">\n\t\t\t\t<p><b>Accesso
+utente</b></p>\n\t\t\t</TD>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_VR.gif\" height=\"26
+\"></TD>\n\t\t</TR>\n\t\t<TR>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_X_E.gif\" height=\"6\"></TD>\n\t\t\t<TD
+width=\"180\" background=\"/images/Login_H.gif\" height=\"6
+\"></TD>\n\t\t\t<TD width=\"6\" background=\"/images/Login_X_W.gif\"
+height=\"6\"></TD>\n\t\t</TR>\n\t\t<TR>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_VL.gif\"></TD>\n\t\t\t<TD vAlign=\"top\"
+width=\"180\">\n\t\t\t\t<P>");
+Line 230: parameterContainer.Controls[0].RenderControl
+(__output);
+Line 231: __output.Write("\n\t\t\t\t\t");
+Line 232: parameterContainer.Controls[1].RenderControl
+(__output);
+Line 233: __output.Write("\n\t\t\t\t\t");
+Line 234: parameterContainer.Controls[2].RenderControl
+(__output);
+Line 235: __output.Write
+("\n\t\t\t\t</P>\n\t\t\t</TD>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_VR.gif\"></TD>\n\t\t</TR>\n\t\t<TR height=\"6
+\">\n\t\t\t<TD width=\"6\" background=\"/images/Login_NE.gif\" height=\"4
+\"></TD>\n\t\t\t<TD width=\"180\" background=\"/images/Login_HB.gif\"
+height=\"6\"></TD>\n\t\t\t<TD width=\"6\"
+background=\"/images/Login_NW.gif\" height=\"4
+\"></TD>\n\t\t</TR>\n\t</TABLE>\n</P>\n<script language=\"JavaScript\"> <!-
+-\n\n\t// keypress handler function\n\tfunction TextBoxKeyHandler(evt)
+{\n\t\tvar usr = document.getElementById('");
+Line 236: __output.Write( txtUsername.ClientID );
+Line 237: __output.Write("');\n\t\tvar pwd =
+document.getElementById('");
+Line 238: __output.Write( txtPassword.ClientID );
+Line 239: __output.Write("');\n\t\tvar keyCode = evt ?
+(evt.which ? evt.which : evt.keyCode) : event.keyCode;\n\t\n\t\tif
+(keyCode == 13)\n\t\t\tif (usr.value != '')\n\t\t\t\tif (pwd.value == '')
+\n\t\t\t\t\tpwd.focus();\n\t\t\t\telse\n\t\t\t\t\t");
+Line 240: __output.Write( Me.Page.GetPostBackClientEvent
+(cmdLogin, "") );
+Line 241: __output.Write(";\n\t}\n\n\n\t// sets up key
+detection event\n\tif (document.layers) document.captureEvents
+(Event.KEYPRESS);\n\tdocument.onkeydown = TextBoxKeyHandler;\n\t \n-->
+</script>\n");
+Line 242: }
+
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen?
+always
+
+Additional Information:
+the error raise even if you comment out the line
+ var usr = document.getElementById('<%= txtUsername.ClientID %>');
+to
+ // var usr = document.getElementById('<%= txtUsername.ClientID %
+>');
+
+the <%= ... %> block always gets compilde