Web and Mobile Apps Codeware
Follow by Email
Friday, December 5, 2014
using renderSection() , renderBody() and renderpage() in asp.net mvc Layouts || Masterpages in asp.net mvc
hi in this post i will show how to use renderSection() , renderBody() and renderpage() in asp.net mvc
create a empty mvc application.
1. In view folder create a Shared folder and add a new view called _Layout.cshtml. this view will act as a master page for all the pages.
in the above code i have used
which will write the contents from the other view.
we need to define section named RSection in the other view
2. now lets use
into our actual view named
to achieve this we need to write this below code
Layout = “~/Views/Shared/_Layout.cshtml”;
in above code i have defined content for section RSection and also used
which will render view from other page named
hi im from homePage.cshtml
will get called by
Share to Twitter
Share to Facebook
Share to Pinterest
Post Comments (Atom)