Want to avoid having to duplicate your MasterPage design that you made in your ASP.NET WebForms project in you new MVC project? There is a simple way to share your master page across the ASP.NET web forms and MVC projects. Here's how:<%@ Master Language="C#" MasterPageFile="~/MasterPages/Root.Master" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewMasterPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="RootTitle" runat="server">
<asp:ContentPlaceHolder ID="RootTitle" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="RootContent" runat="server">
<asp:ContentPlaceHolder ID="RootContent" runat="server"/>
</asp:Content>Replace the URL with the destination of your web forms MasterPage and the ContentPlaceHolderIDs with the respective ones you used in your original web forms master page.
You can then go on to use your new MVC master page as you would before but it will inherit all the content from your web forms master page.



hhjjkkjjkkkkkkkkkkkkkk-+
ReplyDeletei want use webforms like masterpage
ReplyDeletewhat a well articulated comment
ReplyDeleteexellent solution.. it really helped me.. thanks
ReplyDelete