[Mono-list] asp.net does not recognise Subproperties

Jonathan Wheelhouse wheelhouse@pacific.net.au
Wed, 21 Jan 2004 23:22:58 +1100


(I tried to submit this bug via bugzilla but am having no luck even
though I appear to have an account.)

Description of Problem:
asp.net does not recognise Subproperties.

I'm reading Essential ASP.NET with Examples in C# page 240 8.1.6 Subproperties (1).

I tried to run the Subproperties example but got a parser error.

I'm running Debian Sid, Debian's Apache2, Galeon and latest CVS mono and mod_mono.

Steps to reproduce the problem:

1. Setup and run Apache2 and mod_mono as per mod_mono/INSTALL 
nb. To compile mod_mono I had to autogen as
$	cd mod_mono
$	./autogen.sh --with-apxs=/usr/bin/apxs2 --with-apr-config=/usr/bin/apr-config

2. Copy and compile source (see (1)) but I reproduce it here:

SubProperties1.aspx
------------------------------------------------------------------------
<%@ Page Language='C#' %>
<%@ Register Namespace='EssentialAspDotNet.CustomControls'
             TagPrefix='eadn' Assembly='SubProperties1' %>
<html>
<body>
<eadn:SubPropertyControl runat='server' Name='Test'
                         Font-Color='red' Font-Size='24'/>
</body>
</html>
------------------------------------------------------------------------

SubPropertyControl1.cs
------------------------------------------------------------------------
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace EssentialAspDotNet.CustomControls
{
  public class FontFormat
  {
	private int   m_size;
	private Color m_color;

	public FontFormat(int size, Color clr)
	{
	  m_size  = size;
	  m_color = clr;
	}

	public int Size
	{
	  get { return m_size;  }
	  set { m_size = value; }
	}

	public Color Color
	{
	  get { return m_color;  }
	  set { m_color = value; }
	}
  }

  [ParseChildren(false)]
  public class SubPropertyControl : Control
  {
	private string m_Name;
	private FontFormat m_Font = new FontFormat(24, Color.Black);

	public string Name
	{
	  get { return m_Name;  } 
	  set { m_Name = value; }
	}

	public FontFormat Font
	{
	  get { return m_Font; }
	}

	protected override void Render(HtmlTextWriter writer)
	{
		writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, m_Font.Size.ToString());
		writer.AddStyleAttribute(HtmlTextWriterStyle.Color, m_Font.Color.Name);
		writer.RenderBeginTag(HtmlTextWriterTag.Span);
		writer.Write(m_Name);
		writer.RenderEndTag();
	}
  }
}
------------------------------------------------------------------------

Compile like so

mcs -out:bin/SubProperties1.dll -target:library -r:System.Web.dll -r:System.Drawing.dll SubPropertyControl1.cs

3. Start Galeon on URL like http://127.0.0.1:8080/jonathan/SubProperties1.aspx


Actual Results:

Server Error in '/jonathan' Application
Parser Error
Description: Error parsing a resource required to service this request. Review your source file and modify it to fix this error.

Error message: Unrecognized attribute: Font-Color

File name: /home/jonathan/public_html/SubProperties1.aspx    Line: 6

Source Error:

             TagPrefix='eadn' Assembly='SubProperties1' %>
<html>
<body>
<eadn:SubPropertyControl runat='server' Name='Test'
                         Font-Color='red' Font-Size='24'/>
</body>
</html>


Expected Results:
See (1) for actual results but what should happen is the word 'Test' should appear in red.

I've run this example successfully (ie. it produced the right results)
on win2000, framework 1.1, iis5 at work.

How often does this happen? 
Everytime.

Additional Information:
(1) For source and running examples see
http://www.develop.com/books/essentialasp.net/ 
	Listing 8-14  SubPropertiesClient.aspx  run  view source
	Listing 8-15  SubPropertyControl.cs  view source 

Can anybody confirm this is a problem?

Jonathan Wheelhouse