예제 #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);
     });
 }