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

21 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. I was studying some of your articles on this website and I think this website is real informative ! Keep on posting

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

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

    ReplyDelete
  12. 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

  13. 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
  14. NAGAQQ: AGEN BANDARQ BANDARQ ONLINE ADUQ ONLINE DOMINOQQ TERBAIK

    Yang Merupakan Agen Bandarq, Domino 99, Dan Bandar Poker Online Terpercaya di asia hadir untuk anda semua dengan permainan permainan menarik dan bonus menarik untuk anda semua

    Bonus yang diberikan NagaQQ :
    * Bonus rollingan 0.5%,setiap senin di bagikannya
    * Bonus Refferal 10% + 10%,seumur hidup
    * Bonus Jackpot, yang dapat anda dapatkan dengan mudah
    * Minimal Depo 15.000
    * Minimal WD 20.000

    Memegang Gelar atau title sebagai QQ Online Terbaik di masanya

    Games Yang di Hadirkan NagaQQ :
    * Poker Online
    * BandarQ
    * Domino99
    * Bandar Poker
    * Bandar66
    * Sakong
    * Capsa Susun
    * AduQ
    * Perang Bacarrat (New Game)

    Tersedia Deposit Via pulsa :
    Telkomsel & XL

    Info Lebih lanjut Kunjungi :
    Website : NAGAQQ
    Facebook : NagaQQ Official
    Kontakk : Info NagaQQ
    linktree : Agen Judi Online
    WHATSAPP : +855977509035
    Line : Cs_nagaQQ
    TELEGRAM : +855967014811


    BACA JUGA BLOGSPORT KAMI YANG LAIN:
    agen bandarq terbaik
    Winner NagaQQ
    Daftar NagaQQ
    Agen Poker Online

    ReplyDelete
  15. So much useful content, and an enjoyable read too! To learn more on the subject, take a look at another useful article_
    https://cgifurniture.com/realistic-product-rendering-catalogs/

    ReplyDelete
  16. Great points there, thanks. And here is the relevant article, maybe someone will find it useful too photorealistic rendering companies

    ReplyDelete
  17. Apart from legally streaming copyrighted video content, IQiyi also produces video content, including dramas catering to younger viewers, and is one of the most popular and largest Chinese drama websites. bilibili

    ReplyDelete
  18. Do you want to make a video about your project? From here https://viplikes.uk you can get youtube likes and views for your video

    ReplyDelete