public static HelperResult RedefineSection(this WebPageBase page, string sectionName, Func <object, HelperResult> defaultContent) { if (page.IsSectionDefined(sectionName)) { page.DefineSection(sectionName, () => page.Write(page.RenderSection(sectionName))); } else if (defaultContent != null) { page.DefineSection(sectionName, () => page.Write(defaultContent(_o))); } return(new HelperResult(_ => { })); }
public static void PropagateSection(this WebPageBase page, string sectionName) { if (page.IsSectionDefined(sectionName)) { page.DefineSection(sectionName, delegate { page.Write(page.RenderSection(sectionName)); }); } }
public static void RedefineSection(this WebPageBase page, string sectionName) { if (page.IsSectionDefined(sectionName)) { page.DefineSection(sectionName, () => page.Write(page.RenderSection(sectionName))); } }
/// <summary> /// Renders the section as layout region. /// </summary> /// <param name="webPage">The web page.</param> /// <param name="partialViewHtml">The partial view HTML.</param> /// <param name="sectionName">Name of the section.</param> private static void RenderSectionAsLayoutRegion(WebPageBase webPage, string partialViewHtml, string sectionName) { webPage.DefineSection( sectionName, () => { Action <TextWriter> writerAction = tw => tw.Write(partialViewHtml); var result = new HelperResult(writerAction); webPage.Write(result); }); }