示例#1
0
 public static void PropagateSection(this WebPageBase page, string sectionName)
 {
     if (page.IsSectionDefined(sectionName))
     {
         page.DefineSection(sectionName, delegate { page.Write(page.RenderSection(sectionName)); });
     }
 }
示例#2
0
 public static void RedefineSection(this WebPageBase page, string sectionName)
 {
     if (page.IsSectionDefined(sectionName))
     {
         page.DefineSection(sectionName, () => page.Write(page.RenderSection(sectionName)));
     }
 }
示例#3
0
 public static HelperResult RenderSection(this WebPageBase page, string sectionName, Func <object, HelperResult> defaultContent)
 {
     if (page.IsSectionDefined(sectionName))
     {
         return(page.RenderSection(sectionName));
     }
     return(defaultContent(_o));
 }
 public static HelperResult RenderSection(this WebPageBase webPage, string name, Func <dynamic, HelperResult> defaultContents)
 {
     if (webPage.IsSectionDefined(name))
     {
         return(webPage.RenderSection(name));
     }
     return(defaultContents(null));
 }
示例#5
0
 /// <summary>
 /// Extension method to find out if a section is defined in view page
 /// if not, call the defaultContent callback to render default content
 /// </summary>
 /// <param name="page"></param>
 /// <param name="sectionName"></param>
 /// <param name="sectionDefaultContent"></param>
 /// <returns></returns>
 public static HelperResult RenderSection(this WebPageBase page,
                                          string sectionName, Func <dynamic, HelperResult> sectionDefaultContent)
 {
     if (page.IsSectionDefined(sectionName))
     {
         return(page.RenderSection(sectionName));
     }
     return(sectionDefaultContent(null));
 }
示例#6
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(_ => { }));
 }
 public static HelperResult RenderSection(this WebPageBase webPage, string name, IHtmlString defaultContents)
 {
     return(webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : new HelperResult(text => text.Write(defaultContents)));
 }
 public static HelperResult RenderSection(this WebPageBase webPage, string name, HelperResult defaultContents)
 {
     return(webPage.IsSectionDefined(name) ? webPage.RenderSection(name) : defaultContents);
 }