public static void RenderWidgets(this ViewPage pg, string zone, bool useEditor) { var category = pg.CurrentCategory(); if (category != null) { foreach (Widget widget in category.Widgets.Where(x => x.Zone.Equals(zone, StringComparison.InvariantCultureIgnoreCase))) { string viewName = useEditor ? widget.ViewName + "Edit" : widget.ViewName; if (!String.IsNullOrEmpty(viewName)) { pg.Html.RenderPartial(viewName, widget); } else if (!string.IsNullOrEmpty(widget.Title)) { pg.Html.RenderPartial("TitleAndText", widget); } else { pg.Html.RenderPartial("TextOnly", widget); } } } }