[Mono-list] Repeaters
Simon Cunningham
simon@pangomedia.com
Thu, 04 Mar 2004 11:57:30 -0900
This is my first post to this mailing list, so please tell me if this in
not the most appropriate place to ask this question.
I have scoured the net for information regarding this problem, but have
come up empty. Maybe somebody here has some insight into this problem.
I have some C# code that creates a Repeater and then assigns a template
to it. This works as documented under IIS, but doesn't work at all
under Mono. Here is ther error I get:
System.NullReferenceException: A null value was found where an object
instance was required
in <0x0007e> System.Web.UI.TemplateControl:GetTypeFromControlPath (string)
in <0x0001d> System.Web.UI.TemplateControl:LoadTemplate (string)
in <0x00356> Pangomedia.Sitechunk.Page:Render
(System.Web.UI.HtmlTextWriter)
in <0x0001c> System.Web.UI.Control:RenderControl
(System.Web.UI.HtmlTextWriter)
in <0x000de> System.Web.UI.Control:RenderChildren
(System.Web.UI.HtmlTextWriter)
in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter)
in <0x0344e> Pangomedia.Sitechunk.Controller:Render
(System.Web.UI.HtmlTextWriter)
in <0x0001c> System.Web.UI.Control:RenderControl
(System.Web.UI.HtmlTextWriter)
in <0x000de> System.Web.UI.Control:RenderChildren
(System.Web.UI.HtmlTextWriter)
in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter)
in <0x0001c> System.Web.UI.Control:RenderControl
(System.Web.UI.HtmlTextWriter)
in <0x0041f> System.Web.UI.Page:InternalProcessRequest ()
in <0x0008f> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
in <0x00186> .ExecuteHandlerState:Execute ()
in <0x00084> .StateMachine:ExecuteState
(System.Web.HttpApplication/IStateHandler,bool&)
It appears that System.Web.UI.TemplateControl.GetTypeFromControlPath is
returning a null value (called from LoadTemplate()).
Here is the code used:
foo.aspx:
<%@ Page validateRequest="false" language="C#" Debug="true" %>
<%@ register tagprefix="MN" namespace="My.Namespace" assembly="Foo" %>
<MN:Foo id="some_id" runat="server" />
Foo.cs:
using System;
using System.Collections;
using System.Web;
using System.Web.UI.WebControls;
namespace My.Namespace {
public class Foo: System.Web.UI.Page {
System.Web.UI.HtmlTextWriter writer;
public Foo() {
ArrayList list = new ArrayList();
list.Add("foo");
Repeater rpt = new Repeater();
rpt.ItemTemplate = LoadTemplate("bar.ascx");
rpt.DataSource = list;
rpt.DataBind();
Controls.Add(rpt);
base.Render(writer);
}
}
}
bar.ascx
<%@ Control Language="C#" %>
<html>
<head>
</head>
<body>
This is bar.ascx
</body>
</html>
Ideas, anyone?