Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Alphabetic paging in Radgrid

$
0
0

I just thought that most examples are such ugly styling, here is one if you are also using bootstrap in your website:

protectedvoidRadGridRoleMembers_ItemCreated(objectsender, GridItemEventArgs e)
        {
            if(e.Item isGridPagerItem)
            {
                GridPagerItem pagerItem = (e.Item asGridPagerItem);
                pagerItem.PagerContentCell.Controls.Clear();
                HtmlGenericControl nav = newHtmlGenericControl("nav");
                nav.Style.Add("background-color", "#f5f5f5");
                HtmlGenericControl ul = newHtmlGenericControl("ul");
                ul.Attributes.Add("class", "pagination pagination-sm");
                ul.Style.Add("margin", "7px 5px 1px 10px");
                for(inti = 65; i <= 65 + 25; i++)
                {
                    HtmlGenericControl li = newHtmlGenericControl("li");
                    LinkButton lb = newLinkButton();
                    lb.Text = ""+ (char)i;
                    lb.CommandName = "alpha";
                    lb.CommandArgument = ""+ (char)i;
                    li.Controls.Add(lb);
                    ul.Controls.Add(li);
                }
                HtmlGenericControl liAll = newHtmlGenericControl("li");
                LinkButton lbAll = newLinkButton();
                lbAll.Text = "All";
                lbAll.CommandName = "NoFilter";
                liAll.Controls.Add(lbAll);
                ul.Controls.Add(liAll);
                nav.Controls.Add(ul);
                pagerItem.PagerContentCell.Controls.Add(nav);
            }
        }
    }

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>