Master Page In Class Library

G

Guest

We currently have a 1.1 class library which houses the look and feel of our
website by creating the html form dynamically in a base class. We then
distribute our assembly to other application development teams to use so they
have the standard enterprise wide look and feel and only have to worry about
the business functionality of their specific app.

Now comes ASP.Net 2.0 and master pages. It sounded like a great way to make
a template that we could distribute via an assembly (DLL) to the enterprise
so they could continue just inherit the master page and not worry about the
look and style of their apps. However, I can't seem to find a way to
incorporate the master page into a class library. When you create a class
library you don't even have an option to add a master page. Am I missing
something or do we have to stick to the way we were doing it in 1.1? Are
master pages only allowed in a web application project?
 
W

Walter Wang [MSFT]

Hi,

Thank you for posting.

Based on my understanding, there's no easy way to just release a compiled
assembly which contains master pages and let the website use them.

But you can compile the code-behind classes of master pages into a separate
assembly and release those *.master files and the assembly.

Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

But I can't just use the code-behind classes because the actual layout will
be in the master.aspx page...correct ? Doesn't sound like we can use master
pages. I know the way we are building the layout in our current 1.1 assembly
still works in 2.0. I was just hoping there was a way we could take
advantage of the new functionality but I guess we will stick with what we
have. Thanks for your help.
 
C

Cowboy \(Gregory A. Beamer\)

I do not have a solution, but perhaps a few clues:
A master page is a user control. If you want to create the GUI bits in pure
code and compile, you can have a "master page" that is precompiled. I am not
sure how much of a savings this would have over offering a server control
that slaps into a master page in the different apps. It is also going to be
a tricky road, as you are the pioneer in this effort (at least I know of
nobody who has done this before).

Reflecting the MS classes may give you an option. Optionally, you can create
a code snippet that represents the master page (yeah, it is a cheap option
with the downside of still having to update in multiple places if you change
your mind).

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
G

Guest

You mentioned a master page as a control and it created another question in
my mind. Can we create a master page in a web app and have it compiled as
it's own custom/user control that we can distribute ? The key would be to
keep it locked down so other developers couldn't change any of the master
pages functionality or cosmetics but they could still incorporate the control
into their web applications and set their own webpages to inherit from the
master page control we gave them.
 
W

Walter Wang [MSFT]

Since the property MasterPageFile is a url which need to point to an
existing master page file, I think other websites simply cannot work with
master pages without releasing the source code of master page files.


Regards,

Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top