aspx to master page

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

Is there a way to convert a pre-designed aspx page to a master page? I have
tried to save the page as master using the Save As feature but it still
saves as aspx.

Any ideas?

Thanks

Regards
 
The only real differences are the following:


Change the @Page directive to an @Master directive (and, if necessary, any
attributes of the directive)

Add any ContentPlaceHolder controls that you want in the Master Page

In the codebehind, change it so that it inherits from
System.Web.UI.MasterPage instead of System.Web.UI.Page


My recommendation would be to just add a new Master Page and copy & paste
any code you want from the old regular Page, and then make any necessary
modifications. There is no built-in way to do this, because of the way
Master pages are intended to be used (they should only contain content that
is on multiple pages, so one page is not going to be enough for any tool to
determine what belongs in a Master Page). If you have a project that was
designed without using Master Pages that you want to find the similarities
between the pages, a file comparison tool that might be helpful is:

http://www.sourcegear.com/diffmerge/downloads.html

Hopefully all this helps, but as a suggestion for the future, it is best to
create the Master Page before creating any of the actual pages. This way
Visual Studio can let you select which one of your Master Pages you want to
use and automatically put the Content controls in the Page for you when you
create it. Good Luck!
 
Back
Top