コード例 #1
0
        string GetLinkAttributes(int number)
        {
            var urlHelper = Context.Current.Http().GetUrlHelper();

            if (Paging.UseAjaxPost)
            {
                return("href=\"#\" formaction=\"{0}\" data-pagination=\"{1}{2}\""
                       .FormatWith(urlHelper.ActionWithQuery(Paging.Container.GetType().Name + "/Reload"), Paging.Prefix.WithSuffix(".p="), Paging.GetQuery(number)));
            }
            else
            {
                var url = urlHelper.Current(new Dictionary <string, string> {
                    { GetPagingKey(), Paging.GetQuery(number) }
                });

                return("href=\"{0}\"".FormatWith(url) + " data-redirect=\"ajax\"".OnlyWhen(Paging.UseAjaxGet));
            }
        }
コード例 #2
0
ファイル: PaginationNavigation.cs プロジェクト: tohfe/Olive
        string GetLinkAttributes(int number, string ariaLabel = null)
        {
            if (ariaLabel.IsEmpty())
            {
                ariaLabel = "Go to page " + number;
            }
            var result    = "aria-label=\"" + ariaLabel + "\" ";
            var urlHelper = Context.Current.Http().GetUrlHelper();

            if (Paging.UseAjaxPost)
            {
                return(result + "href=\"#\" formaction=\"{0}\" data-pagination=\"{1}{2}\""
                       .FormatWith(urlHelper.ActionWithQuery(Paging.Container.GetType().Name + "/Reload"), Paging.Prefix.WithSuffix(".p="), Paging.GetQuery(number)));
            }
            else
            {
                var url = urlHelper.Current(new Dictionary <string, string> {
                    { GetPagingKey(), Paging.GetQuery(number) }
                });

                return(result + "href=\"{0}\"".FormatWith(url) + " data-redirect=\"ajax\"".OnlyWhen(Paging.UseAjaxGet));
            }
        }