[WARNING : A/V UNSCANNABLE] RE: [Mono-dev] System.Web.UI.Page patch
Chris Toshok
toshok at ximian.com
Tue Apr 25 13:50:41 EDT 2006
On Tue, 2006-04-25 at 02:16 -0700, Andrew Skiba wrote:
> > 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:
ah, sorry - I wasn't looking at the line numbers, I just searched for
the surrounding patch context.
> 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.
My comment was made under the assumption that the ApplyTheme call was in
OnInit (as above.)
I'll take a look at this further tonight probably.
Chris
More information about the Mono-devel-list
mailing list