asp.net mvc 3 - Can _Layout plus a partial view be specified in _ViewStart.cshtml of an MVC3 app? -
i have suite of several mvc3 web applications, of reference common core.dll. have compiled common views using razorgenerator, , subscribing sites find relevant views pre-compiled .dll without problem.
i trying same layout page, common across sites too, save 1 or 2 divs specific particular site. works fine, in as _layout view served doing this:
@{ layout = "~/views/shared/_layout.cshtml"; } but, site specific divs in layout populated, want have partial view in specific site , use jquery set html of placeholding div in _layout. like:
@{ layout = "~/views/shared/_layout.cshtml"; } //have hidden div containing partial view sits in specific site <div id="sitespecificstuff" style="display:none"> @html.partial("_sitespecificstuff", model) </div> // use jquery populate html of placeholding div on _layout // of partial view <script type="text/javascript"> $(document).ready(function () { $("#divplaceholderonlayout") .html($("sitespecificstuff").html()); }); </script> i have tried _viewstart not re-fire on every post. possible using different approach?
i think you're looking this:
@rendersection("yousection", required: false)
Comments
Post a Comment