find a location for property in a new city

Tuesday, 8 June 2010

Use WebForms MasterPage in MVC project

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:

Make a new "MVC 2 View Master Page" in your /Views/Shared folder and add the content:
<%@ 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.

Note

Any form post controls on your web forms master page will not work on your MVC pages. I have found a way though which I explained in my post about making form posts work in a webform master page nested MVC page if that sort of thing interests you.

Follow britishdev on Twitter

22 comments:

  1. hhjjkkjjkkkkkkkkkkkkkk-+

    ReplyDelete
  2. i want use webforms like masterpage

    ReplyDelete
  3. what a well articulated comment

    ReplyDelete
  4. exellent solution.. it really helped me.. thanks

    ReplyDelete
  5. Informative post. I am happy to visit your blog. Thanks for sharing this post.
    electrical maintenance in chennai

    ReplyDelete
  6. Good article. This is very useful, Thanks for sharing this post.
    school websites design

    ReplyDelete
  7. Thank you for this great explanation. It was really helpful.

    3d rendering services

    ReplyDelete
  8. Nice post! I like your post a lot and rendering images too. Keep posting such a nice blogs.
    3d rendering

    ReplyDelete
  9. Bài viết bạn rất hay:



    Chúng tôi là đơn vị cung cấp các sản phẩm chất lượng như:



    Giảo cổ lam



    giảo cổ lam giải độc gan



    giảo cổ lam giảm béo

    ReplyDelete
  10. Bài viết bạn rất hay:



    Chúng tôi là đơn vị cung cấp các sản phẩm chất lượng như:



    lều xông hơi



    lều xông hơi sau sinh



    lều xông hơi giá bao nhiêu




    ReplyDelete
  11. Nice post https://ufo3d.com/

    ReplyDelete
  12. I was studying some of your articles on this website and I think this website is real informative ! Keep on posting

    ReplyDelete
  13. ترجمه تخصصی فارسی به انگلیسی با کمترین قیمت و بهترین کیفیت .به بهترین، روان ترین و تخصصی ترین شکل متن های فارسی خود را به انگلیسی ترجمه کنید. همراه با کادری مجرب و کارکشته از بهترین مترجمتن سطح کشور، با تسلط کامل بر زبان انگلیسی و دارای تجربه حداقل 10 سال در مترجمی زبان و ترجمه تخصصی فارسی به انگلیسی

    ReplyDelete
  14. Have you seen our new masterwriter project? We are looking for a talented essay writers

    ReplyDelete
  15. Permainan Sabung Ayam tentunya sudah pada tahu ya, yang dimana ayam melawan ayam pertandingan yang sangat seru ini bisa kalian nonton secara live lohh, banyak yang bermain di situs kami dan merasa sangat nyaman, bagi kalian yang ingin bermain bisa kunjungi situs kami, dijamin kalian akan merasa sangat senang.

    download s128 apk mobile

    aplikasi s128 terbaru

    link download s128 apk

    link s128 apk

    cara download sabung ayam

    cara download s128 apk

    cara download aplikasi s128


    daftar judi adu ayam

    daftar adu ayam

    cara daftar s128

    cara daftar sabung ayam

    cara daftar sabung ayam s128

    cara daftar s128 sabung ayam

    cara daftar s128 apk


    login link alternatif s128

    link login alternatif s128

    ReplyDelete
  16. Its a great pleasure reading this post. Want to share with another useful article https://ufo3d.com/product-rendering-cost-5-ways-to-reduce

    ReplyDelete
  17. Permainan tembak ikan adalah permainan yang paling rame orang mainkan, apalagi jika pelayanannya yang sangat memuaskan bagi anda tentunya kalian pasti akan merasa sangat puas juga kan ?, bagi kalian yang sangat menyukai permainan tembak ikan bisa datang ke situs kami :)

    layanan livechat joker123

    livechat joker123


    joker123 deposit 25rb

    joker123 deposit pulsa

    deposit slot joker123 ovo

    livechat joker123


    login joker388 slot apk

    daftar akun joker388

    download aplikasi joker388 apk

    aplikasi joker388 apk


    login joker388


    joker123 deposit via pulsa

    deposit joker123 pulsa


    deposit joker388 pulsa

    deposit slot pulsa

    deposit slot aplikasi ovo


    ReplyDelete

  18. Thanks for sharing this information! So useful. I have also read an article on the same subject here, with some good points too
    https://ufo3d.com/product-visualization-5-uses-for-manufacturers

    ReplyDelete
  19. Thanks for sharing this information is useful for us, also I read an article on the same theme https://cgifurniture.com/product-3d-rendering-digital-marketing/

    ReplyDelete