[Mono-dev] System.Web.UI.Page patch

Andrew Skiba andrews at mainsoft.com
Tue Apr 25 05:16:10 EDT 2006


> I'd like to see the test used for this as well.

Did you see the standalone test that I sent yesterday? For convenience,
I attach it to this message, too. It covers the following patches:

ApplyTheme.patch
Page.Web.Config.patch
PageTheme.patch

> At first blush the theme change looks ok, but I really don't 
> like the idea of adding the ApplyTheme behavior to OnInit.  
> Unless, of course, this is what actually happens in MS's 
> implementation.

It's not OnInit, it's in CreateChildControls flow. To figure that out in
MS implementation I made this:

	public class MyLogin:Login
	{
		protected override void OnInit (EventArgs e)
		{
			Trace.WriteLine ("before Login.OnInit");
			base.OnInit (e);
			Trace.WriteLine ("after Login.OnInit");
		}
		protected override void AddedControl
(System.Web.UI.Control control, int index)
		{
			Trace.WriteLine ("before Login.AddedControl");
			base.AddedControl (control, index);
			Trace.WriteLine ("after Login.AddedControl");
		}

		protected override void  CreateChildControls()
		{
			Trace.WriteLine ("before
Login.CreateChildControls");
			base.CreateChildControls ();
			Trace.WriteLine ("after
Login.CreateChildControls");
		}
	}

	public class MyImageButton:ImageButton
	{
		protected override void OnInit (EventArgs e)
		{
			Trace.WriteLine ("ImageButton.OnInit");
			base.OnInit (e);
		}
		public override void ApplyStyleSheetSkin
(System.Web.UI.Page page)
		{
			Trace.WriteLine
("ImageButton.ApplyStyleSheetSkin");
			base.ApplyStyleSheetSkin (page);
		}

		public override string ImageUrl
		{
			get
			{
				return base.ImageUrl;
			}
			set
			{
				Trace.WriteLine ("Set
ImageButton.ImageURL");
				base.ImageUrl = value;
			}
		}
	}
	
and changed in aspx <asp:login> and <asp:imagebutton> to <my:MyLogin>
and <my:MyImageButton>

the output looked like:

before Login.OnInit
after Login.OnInit
before Login.CreateChildControls
ImageButton.ApplyStyleSheetSkin  	
Set ImageButton.ImageURL		
before Login.AddedControl
ImageButton.OnInit
after Login.AddedControl
after Login.CreateChildControls

> 
> Also, the master page change doesn't seem necessary to me, in 
> the scope of the greater change. The controls will have 
> their OnInit methods's called properly when they're added to 
> the already Init'ed controls.

If you do ApplyMasterPage after InitRecursive, then elements defined on
master page do not get their themes. Just try the standalone test I
sent, the difference is clear.

If you have no further comments, I will commit 3 patches I listed at the
beginning of this message and the standalone test.

Thank you.
Andrew.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PageLinks.tar.gz
Type: application/x-gzip
Size: 11768 bytes
Desc: PageLinks.tar.gz
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060425/26158528/attachment.gz 


More information about the Mono-devel-list mailing list