Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've started to learn MVC 4. I would like to know about how can I add multiple content part in a Razor Layout page as we did in Master page. Could you please help me.
Posted

1 solution

Use a RenderSection

Please go through below link

ASP.Net MVC 4 - Layout and Section in Razor
http://www.c-sharpcorner.com/UploadFile/3d39b4/Asp-Net-mvc-4-layout-and-section-in-razor/[^][]
 
Share this answer
 
Comments
Libin C Jacob 7-Jan-14 3:05am    
Hi Sandeep,
Thank you for the response of my question. I went through the above like. Actually my need is

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication5.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
Content Page 1

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">


how to replace the above master page to a Razor layout.
Sandeep Singh Shekhawat 7-Jan-14 3:57am    
@Jacob You first need to create _Layout.cshtml then you can use on each page. You can't use master page in razor.
Libin C Jacob 7-Jan-14 5:36am    
Thanks Sandeep It's working

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