Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to apply masterpage to existing page?

Status
Not open for further replies.

onechuck

IS-IT--Management
Feb 14, 2006
79
US
Is there a simple way to apply the master page to a bunch of files at once? I was watching a video tutorial and it seemed that I have to manually delete the existing code and type in the new master page name. I was hoping for a simpler way than that. Your help is grateful.

By the way, I'm using Visual Web Developer Express.
 
<%@ Page Language="VB" MasterPageFile="path_to_master_page.master" ... %>

<asp:Content ID = "Content1" ContentPlaceHolderID = "ContentPlaceHolder1" Runat = "Server">

' The XML code in here.

</asp:Content>



 
Thanks for the response. But I already know that. If you read my questions again, I want to apply this to a bunch of files at once and not one by one.
 
I don't think there's a way of applying a master page to a 'set' of pages. The only way you could do it would be to create a program that opens each page, looks for the header:

<%@ Page Language="VB" ....%>

and replaces that with

<%@ Page Language="VB" MasterPageFile="path_to_master_page.master" ... %>

That's the quick way I know.
 
Maybe you could define that master page in the web.config
 
Ha, that's an idea. How do I do that and will it automatically apply to all my of existing files that are not using the master page?
 
Type "Master Pages" into MSDN and all will become clear with the first result...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Can be defined in web.config at any folder level and dictate the masterpagefile to be applied to ASPX pages that contain <asp:content> controls

<system.web>
<pages masterPageFile="masterpage.master" />
</system.web
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top