Thanks for your reply Andrew,
As for your two questions:
1. I don't have any *.designer.cs files in any of my web projects created
with VS2005. There's nothing stored with my codebehind files. The
definitions for any controls I create in the web page seem to be hidden.
Why? Where are they?
=============================================
For ASP.NET 2.0 applications, the "*.designer.cs" file only exists in "Web
Application Project" which is available in Visual Studio 2005 after you
installed service pack 1. For each aspx page or usercontrol( or some other
component like DataSet xsd), they all have some IDE/designer generated
code. For Visual Studio 2005/ASP.NET 2.0, the default web site project do
not explicitly provide a "designer.cs" file, it is dynamically generated
and compiled at runtime(new dynamic compilation feature of asp.net 2.0).
Therefore, if you're using website ASP.NET project, you will not see that
file.
#Visual Studio 2005 Web Application Projects
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx
#Web Application Project Model Essentials (C#)
http://msdn2.microsoft.com/en-us/library/bb166416(VS.80).aspx
#Visual Studio 2005 Web Application Project Tutorials and Help
http://webproject.scottgu.com/Default.aspx
The "Web application project" is mainly provided for developing ASP.NET 2.0
application under a VS 2003/ASP.NET 1.X like project. You can build the
entire project to get a single precompiled assembly. You can get more info
on this project model through the above reference.
2. I have two MasterPage's, one of which is selected at runtime in the
preinit event. They both inherit the same class, i.e. they refer to the
same
codebeind file. This seemed to work until I added this to my webform
codebehind page:
=============================================
The problem here is because you're using the ASP.NET 2.0 website project
which will dynamically compile each page, and it is possible that different
pages are dynamically compiled into different assemblies. And since you
have two master pages which refer to the same codebehind, at runtime, the
following problem will occur:
1) The application runtime first compile master pageA(when master pageA is
first used), and generate an random assembly contains the master page A's
compiled class(from codebehind)
2) The application runtime then compile master pageB(when it is first
used), and try generate a new assembly which also contains the the same
class(since master page A use the identical codebehind class as master B),
that cause the conflict here.
I haven't tried this in web application project, so far, based on my
understanding, for default web site project model, I suggest you consider
change your two master pages with the following steps:
** make your two master page use different codebehind file(so that there
won't occur two dynamically compiled asseblies contains the same class)
** if you want to share some codelogic (properties or function in the
master page file), you can try defining another base class and put it into
App_Code folder, and let your two master page codebehind class derived from
this central base class
If you have anything unclear or any further questions here, please feel
free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.