[Mono-dev] Controls in HTML comment block behave different in .Net and Mono

Arnhoffer Károly karnhoffer at ecron.hu
Mon Feb 6 03:15:42 EST 2006


The "Src" directive won't work for me. I get compilation errors under both Mono and .Net (attached).

(K)
-----Original Message-----
From: peter [mailto:apvx95 at dsl.pipex.com] 
Sent: Friday, February 03, 2006 6:57 PM
To: Arnhoffer Károly
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Controls in HTML comment block behave different in .Net and Mono


You may have fallen foul of the same thing I did:


Codebehind="WebForm1.aspx.cs"


is a Visual Studio thing, apparently.  You want to replace "CodeBehind" with "Src".

It worked for me, anyway.

Cheers


Peter

Arnhoffer Károly wrote: 
Hi,

When I have an ASP.Net control in an HTML comment block of an aspx page it does not compile under Mono but it does compile under .Net.

Exmple aspx:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MonoCharsetTest.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<meta name="Content-Type" content="text/html; charset=utf-8">
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<!--
			<INPUT id="Button1" type="button" value="Button" name="Button1" runat="server">
			-->
		</form>
	</body>
</HTML>

Example cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MonoCharsetTest
{
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected System.Web.UI.HtmlControls.HtmlInputButton Button1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			Button1.Value="Hello";
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

	}
}

Results when running on mono: 

Server error in '/c' application

--------------------------------------------------------------------------------

Description: Error processing request. 
Error Message: HTTP 500. 

Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object
in <0x00012> MonoCharsetTest.WebForm1:Page_Load (System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00117> System.Web.UI.Control:OnLoad (System.EventArgs e)
in <0x000e5> System.Web.UI.Control:LoadRecursive ()
in <0x0011e> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)
 
With .Net I get a page without the button and no compilation error.

Wich is the right behaviour?
VS.Net project, Mono and .Net results are attached.

Thanks!

Károly
  





 





Server error in '/c' application


Description: Error processing request. 
Error Message: HTTP 500. 
Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object
in <0x00012> MonoCharsetTest.WebForm1:Page_Load (System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00117> System.Web.UI.Control:OnLoad (System.EventArgs e)
in <0x000e5> System.Web.UI.Control:LoadRecursive ()
in <0x0011e> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)






_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060206/dff0f713/attachment.htm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060206/dff0f713/attachment-0001.htm 


More information about the Mono-devel-list mailing list