Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting master page 'base type' inheritance to work with code behind

Posted on 2009-05-13
1
Medium Priority
?
801 Views
Last Modified: 2013-12-17
There is a sample of dynamic master pages here
http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx
...go down to the section 'Attaching Master Pages Dynamically'...

I am able to copy and paste it here and get it working as stated.  I cannot get it to work if my Master pages have code behind files.  I get a 'Compilation Error' that there is a conflict between BaseMaster and what appears to be another server created master page.  I tried inheriting both BaseMaster and also System.Web.UI.MasterPage but both give the error.

So my question is how do I get it to work when the blue and green master pages have code behind files?
0
Comment
Question by:stee1hed
1 Comment
 

Accepted Solution

by:
stee1hed earned 0 total points
ID: 24378195
I figured it out.

In the aspx files, change the 'Inherits' attribute to the code behind class (not the BaseMaster class), then in the code behind class have it inherit the BaseMaster class.

So when aspx uses a code behind file they are not really treated as the same file, or one entity, as I thought.  The aspx file refers to the code behind file which can inherit another class, etc.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Screencast - Getting to Know the Pipeline
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question