473,395 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MasterPage in Class library

Hi,

is it possible to move a MasterPage into a class library so that it can be
used by multiple websites?

if not, is there an alternative way?

reagrds,
Mar 30 '07 #1
2 1132
Any particular reason you cannot simply move the .master file around?
Consolidate all your server-side code (cs or vb) into the actual .master
file just as you could any .aspx file and move it around.

I think your only other option would be creating a class that inherits from
System.Web.UI.MasterPage and overriding the correct events to render out the
proper HTML, then include the proper ContentPlaceHolders into the control
tree. All of this might be a bit of a pain. I don't see why it wouldn't
work, though; on the other hand I'm not sure how kindly Visual Studio's
design-time facilities for master-page development would take to all
this....dunno...never tried....

--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
"Joey" <jo**@mail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,

is it possible to move a MasterPage into a class library so that it can be
used by multiple websites?

if not, is there an alternative way?

reagrds,

Mar 30 '07 #2
"Ben Rush" <kw*****@yahoo.comwrote in message
news:eM**************@TK2MSFTNGP02.phx.gbl...
Any particular reason you cannot simply move the .master file around?
Consolidate all your server-side code (cs or vb) into the actual .master
file just as you could any .aspx file and move it around.

I think your only other option would be creating a class that inherits
from System.Web.UI.MasterPage and overriding the correct events to render
out the proper HTML, then include the proper ContentPlaceHolders into the
control tree. All of this might be a bit of a pain. I don't see why it
wouldn't work, though; on the other hand I'm not sure how kindly Visual
Studio's design-time facilities for master-page development would take to
all this....dunno...never tried....
Generally, I use Visual SourceSafe for this sort of re-use... Just create
the MasterPage (and its associated code-behind file) once and then, in VSS,
share it into all the other projects which need it... Then, any time you
change it in one project, it will automatically update it in all the
others...
Mar 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark Parter | last post by:
I've "converted" the code at http://www.eggheadcafe.com/articles/20040613.asp to VB.NET as I'd like to implement this as my application uses quite complex GridViews and various other controls on...
9
by: Leffe Andersson | last post by:
Hi folks! I have a MasterPage with some public methods, and I would like to call them from a (app_code) class. Is it possible to set a directive or an assembly reference to a MasterPage from a...
9
by: User | last post by:
OK, I asked in a reply, but I've wasted far too long so I'm going to put a new post out there in hopes that it will be more visible. I have a MasterPage. I want to call a method declared in that...
2
by: dawg1998 | last post by:
I am trying to access a label located in a MasterPage from a class located in my application's App_Code folder. The problem seems to be that the class cannot communicate with the MasterPage due to...
3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
0
by: Stan SR | last post by:
Hi, It's maybe a stupid question. I have a class that I call from each of my pages. I would like to know if it's possible to "instantiate" this class from my masterpage and call all the...
2
by: ThunderMusic | last post by:
Hi, Maybe there is another way of doing this, but here's my problem... I have my web site where I have a master page to have a common layout and a common behavior on all my pages (that's what...
7
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be...
0
by: Tommy Jakobsen | last post by:
Hi. Is there a problem when trying to use Javascript on a nested masterpage? On my masterpage, i've got this in the <head>: <asp:ContentPlaceHolder ID="HeadContent" runat="server" /> And on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.