public static MvcHtmlString ThemedPagerFor <VM>( this HtmlHelper <VM> htmlHelper, Expression <Func <VM, int> > page, Expression <Func <VM, int> > prevPage = null, Expression <Func <VM, int> > totalPages = null, string name = "SubmitPager" ) { if (page == null) { throw (new ArgumentNullException("page")); } string themeName = ThemedControlsStrings.GetTheme(); htmlHelper.ViewData["ThemeParams"] = new SubmitPagerDescription { Page = page, PrevPage = prevPage, TotalPages = totalPages, HtmlHelper = htmlHelper }; MvcHtmlString res; try { res = htmlHelper.Partial("Themes/" + themeName + "/" + name, htmlHelper.ViewData); } finally { htmlHelper.ViewData["ThemeParams"] = null; } return(res); }
public static MvcHtmlString ThemedChoiceListFor <TModel, TChoiceItem, TValue, TDisplay> ( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, IEnumerable <TValue> > > expression, ChoiceList <TChoiceItem, TValue, TDisplay> choiceList, string name = "ChoiceList") where TValue : IComparable { if (expression == null) { throw (new ArgumentNullException("expression")); } if (choiceList == null) { throw (new ArgumentNullException("choiceList")); } string themeName = ThemedControlsStrings.GetTheme(); ViewDataDictionary <dynamic> dataDictionary = new ViewDataDictionary <dynamic>(htmlHelper.ViewData.Model); dataDictionary.TemplateInfo.HtmlFieldPrefix = htmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix; dataDictionary["ThemeParams"] = new ChoiceListDescription { Expression = expression, ChoiceList = choiceList, HtmlHelper = htmlHelper }; MvcHtmlString res; res = htmlHelper.Partial("Themes/" + themeName + "/" + name, dataDictionary); return(res); }
public static MvcHtmlString ThemedSortableListFor <M, TItem>( this HtmlHelper <M> htmlHelper, Expression <Func <M, IEnumerable <TItem> > > expression, SortableListFeatures sortableListFeatures, Columns <TItem> fields, Expression <Func <M, IEnumerable <KeyValuePair <LambdaExpression, OrderType> > > > orderExpression = null, Expression <Func <M, int> > page = null, Expression <Func <M, int> > prevPage = null, Expression <Func <M, int> > pageCount = null, Expression <Func <M, Expression <Func <TItem, bool> > > > filter = null, string title = null, string name = "SortableList" ) where TItem : class, new() { if (expression == null) { throw (new ArgumentNullException("(expression")); } if (fields == null || fields.Fields == null || fields.Fields.Count == 0) { throw (new ArgumentNullException("fields")); } string themeName = ThemedControlsStrings.GetTheme(); htmlHelper.ViewData["ThemeParams"] = new SortableListDescription { ToShow = expression, ToOrder = orderExpression, Fields = fields.Fields, HtmlHelper = htmlHelper, Features = sortableListFeatures, Title = title, Page = page, PrevPage = prevPage, PageCount = pageCount, Filter = filter }; MvcHtmlString res; try { res = htmlHelper.Partial("Themes/" + themeName + "/" + name, htmlHelper.ViewData); } finally { htmlHelper.ViewData["ThemeParams"] = null; } return(res); }
public static MvcHtmlString ThemedPager <VM>( this HtmlHelper <VM> htmlHelper, int currPage, string parameterName, string actionName, System.Web.Routing.RouteValueDictionary otherParameters, int?totPages = null, string targetIdName = "", string controllerName = null, string routeName = null, string protocol = null, string hostname = null, string fragment = null, string name = "GetPager") { string themeName = ThemedControlsStrings.GetTheme(); htmlHelper.ViewData["ThemeParams"] = new LinkPagerDescription { CurrPage = currPage, ParameterName = parameterName, ActionName = actionName, HtmlHelper = htmlHelper, TotPages = totPages, TargetIdName = targetIdName, ControllerName = controllerName, OtherParameters = otherParameters, RouteName = routeName, Protocol = protocol, Hostname = hostname, Fragment = fragment }; MvcHtmlString res; try { res = htmlHelper.Partial("Themes/" + themeName + "/" + name, htmlHelper.ViewData); } finally { htmlHelper.ViewData["ThemeParams"] = null; } return(res); }
public static MvcHtmlString ThemedClientPager <VM>( this HtmlHelper <VM> htmlHelper, string pagerName, int initialPage = 1, string totalPagesName = null, int?totalPages = null, string pagePrefix = null, string pagePostfix = null, bool causeSubmit = false, string name = "ClientPager") { if (string.IsNullOrWhiteSpace(pagerName)) { throw (new ArgumentNullException("pagerName")); } string themeName = ThemedControlsStrings.GetTheme(); htmlHelper.ViewData["ThemeParams"] = new ClientPagerDescription { PagerName = pagerName, InitialPage = initialPage, TotalPagesName = totalPagesName, TotalPages = totalPages, HtmlHelper = htmlHelper, PagePrefix = pagePrefix, PagePostfix = pagePostfix, CauseSubmit = causeSubmit }; MvcHtmlString res; try { res = htmlHelper.Partial("Themes/" + themeName + "/" + name, htmlHelper.ViewData); } finally { htmlHelper.ViewData["ThemeParams"] = null; } return(res); }