in _layout.cshtml:
<section class="container content-section text-center"> @renderbody() </section>
i want have "section" around when "body" not home page.
i thinking of detecting url, realized have many urls bound website, it's not smart way it.
so there make "section" wrapper smarter enough know when appear when not?
thank you.
you can check controller executing action , put check on homepage controller :
@{ var controllername = viewcontext.routedata.values["controller"].tostring(); var actionname = viewcontext.routedata.values["controller"].tostring(); } @if(controllername == "homepage" && actionname == "youractionname") { @renderbody() } else { <section class="container content-section text-center"> @renderbody() </section> }
Comments
Post a Comment