[Mono-list] Does mono support Codebehind in ASP .net?

Golo Haas webmaster@golohaas.de
Sat, 07 Feb 2004 18:56:07 +0100


Okay, thank you very much for the solution ... I'm sorry for such a 
stupid question ...

Just one problem resides: If I try to compile the index.aspx.cs file:

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace MyWebApp
{
   public class Index : Page
   {
     private HtmlGenericControl Message;

     private void PageLoad()
     {
       Message.InnerHtml = "ASP .net mit Codebehind";
     }

     override protected void OnInit(EventArgs eventArgs)
     {
       this.Load += new EventHandler(this.PageLoad);
       base.OnInit(eventArgs);
     }
   }
}

with

mcs -r:System.Web index.aspx.cs

I get the following error message, that doesn't tell anything at least 
to me:

Exception caught by the compiler while compiling:
    Block that caused the problem begin at: index.aspx.cs: (16)
                      Block being compiled: [index.aspx.cs: 
(17),index.aspx.cs: (20)]
System.ArgumentNullException: null key
Parameter name: key
         in Hashtable.Find (object)
         in Hashtable.GetImpl (object)
         in Hashtable.get_Item (object)
         in Invocation.GetParameterData (System.Reflection.MethodBase)
         in DelegateCreation.Error_NoMatchingMethodForDelegate 
(Mono.CSharp.MethodGroupExpr, System.Type, System.Reflection.MethodBase, 
Mono.CSharp.Location)
         in DelegateCreation.ResolveMethodGroupExpr 
(Mono.CSharp.EmitContext, Mono.CSharp.MethodGroupExpr)
         in NewDelegate.DoResolve (Mono.CSharp.EmitContext)
         in Expression.Resolve (Mono.CSharp.EmitContext, 
Mono.CSharp.ResolveFlags)
         in Expression.Resolve (Mono.CSharp.EmitContext)
         in New.DoResolve (Mono.CSharp.EmitContext)
         in Expression.Resolve (Mono.CSharp.EmitContext, 
Mono.CSharp.ResolveFlags)
         in Expression.Resolve (Mono.CSharp.EmitContext)
         in CompoundAssign.DoResolve (Mono.CSharp.EmitContext)
         in Expression.Resolve (Mono.CSharp.EmitContext, 
Mono.CSharp.ResolveFlags)
         in Expression.Resolve (Mono.CSharp.EmitContext)
         in ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext)
         in StatementExpression.Resolve (Mono.CSharp.EmitContext)
         in Block.Resolve (Mono.CSharp.EmitContext)
         in EmitContext.EmitTopBlock (Mono.CSharp.Block, 
Mono.CSharp.InternalParameters, Mono.CSharp.Location)

So, obviously, the problem are the lines

       this.Load += new EventHandler(this.PageLoad);
       base.OnInit(eventArgs);

But what's wrong with them?

Thanks in advance - and this was hopefully my last question so far ;-)


Golo
-- 
Microsoft Community Leader
http://www.golohaas.de