コード例 #1
0
 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(_ => { }));
 }
コード例 #2
0
ファイル: WebPageHelper.cs プロジェクト: lulzzz/WF
 public static void PropagateSection(this WebPageBase page, string sectionName)
 {
     if (page.IsSectionDefined(sectionName))
     {
         page.DefineSection(sectionName, delegate { page.Write(page.RenderSection(sectionName)); });
     }
 }
コード例 #3
0
 public static void RedefineSection(this WebPageBase page, string sectionName)
 {
     if (page.IsSectionDefined(sectionName))
     {
         page.DefineSection(sectionName, () => page.Write(page.RenderSection(sectionName)));
     }
 }
コード例 #4
0
 /// <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);
     });
 }