Click here to Skip to main content
15,889,428 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
suppose I have 30 pages with repeating header and footer. Now I want to shift the header and footer in layout page and set the layout attribute in each page at once without copy and paste. Can any one please suggest how to do so. Thanks
Posted
Comments
Krunal Rohit 22-Oct-15 8:52am    
Just a guess, select all your content pages (using shift or ctrl key) and right click on them, see if you can find the option for setting the Layout page.

-KR

1 solution

Create a file in the Views folder called _ViewStart.cshtml (or _ViewStart.vbhtml for a VB.NET project). Set the layout in that file, and it will apply to all views.

ASP.NET MVC 3: Layouts with Razor | ScottGu's Blog[^]

NB: If you already have the header and footer in each view file, then you'll have to edit each file individually to remove them.
 
Share this answer
 
Comments
Arkadeep De 22-Oct-15 13:40pm    
Thanks a lot Richard. I was looking for it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900