Thursday, June 15, 2006

A Master Page GotCha...


I was messing around with master pages and found something very strange...

I have a page1.aspx referencing master.master.

I made an override
CreateChildControls()
{
   base.CreateChildControls();
    Controls.InsertAt(0,_MyErrorLink = new HyperLink());
}

I just want to show this debug link on top all the time...

The page comes up but when the page posts, the rendered page is completely blank! No bytes are sent out whatsoever (as Trace="true" proves).

There is no exception raised, it is just blank.

So it seems that the top level of the control hierarchy should always be the master page and monkeying with the sequence in the CreateChildControls is not a good idea.

What I am doing I think is legal since the controls collection is created the same  way everytime.

A bug/limitation I guess. Conclusion, don't do it

CF











__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

No comments: