RE: Can I still use base page classes in Whidbey?

I've exchanged a couple emails with some Microsofties relating to the issue I posted a couple days ago regarding using base page classes in Whidbey.  It turns out that the "new model" of compiling the aspx pages prevents the base page setup that I have used on a couple different applications from working.  There are a number of workarounds to the problem but they all involve updating code in one way or another.

Option 1
In InitializeComponent (or OnInit) in the base page use FindControl to set the reference to the control.

            saveButton = (Button) this.FindControl("saveButton");  // MyBasePage

Option 2
Update each page to set the button instance in the base class to the version in the code behind class.

            base.saveButton = this.saveButton  // Default.aspx.cs

Option 3
Use reflection to automatically hook up the controls.  This causes a performance impact so isn't a good idea in most situations.

I wish this would "just work" (tm) however after a couple conversations with the peeps over at MS I think I understand the basics of why it's an issue.  I think the problem will somewhat go away as I migrate to v2 and begin to take advantage of all the new "super fun cool stuff" that it provides.

I do want to give a quick shout out to Scott Guthrie and his team for following up on the issue pretty much immediately after I posted.  Within a couple hours I had exchanged several email's with his team (I'm assuming) and at least had an understanding of what the issue was.  It's nice to see such responsiveness from the powers that be over in the "big house".

 

Post a Comment

 
 
Prove you're not a spammer: 
2 + 2 =