This is a migrated thread and some comments may be shown as answers.

Paging - Alphabetic & Slider

7 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 20 Mar 2008, 07:51 PM
Hi..
How do you do both types of paging on the same grid?
I'd like to do the alphabetic paging as well as the built in Slider.
Thanks again!

7 Answers, 1 is accepted

Sort by
0
314
Top achievements
Rank 1
answered on 21 Mar 2008, 01:52 AM
I tried, but fail too, I think RadGrid do not support aplhabetic and paging in the same time, you look that her sample also don't do it. Also, I found that it also not support sorting in this schedule
0
Leon
Top achievements
Rank 1
answered on 21 Mar 2008, 06:23 AM
John,

You can implement the alphabetic functionality through the Command Item. This way you will be able to use the Slider as well.

-Leon
0
314
Top achievements
Rank 1
answered on 21 Mar 2008, 11:00 AM
Can you provide a sample to me, as I was followed by /radcontrols_prometheus/Grid/Examples/Programming/AlphabeticPaging/DefaultCS.aspx to do it
0
Leon
Top achievements
Rank 1
answered on 21 Mar 2008, 02:47 PM
Sure, find my code below:

            <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" AllowPaging="True" PageSize="5" Skin="Inox" 
                runat="server" GridLines="None" Width="100%" OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand"
                <PagerStyle Mode="Slider"/> 
                <ItemStyle HorizontalAlign="Center" /> 
                <AlternatingItemStyle HorizontalAlign="Center" /> 
                <MasterTableView CommandItemDisplay="Top"
                    <CommandItemTemplate> 
                        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> 
                    </CommandItemTemplate> 
                </MasterTableView> 
            </telerik:RadGrid> 

        public void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridCommandItem) 
            { 
                GridCommandItem commandItem = (e.Item as GridCommandItem); 
                PlaceHolder container = (PlaceHolder)commandItem.FindControl("PlaceHolder1"); 
 
                for (int i = 65; i < 65 + 25; i++) 
                { 
                    LinkButton linkButton1 = new LinkButton(); 
                    LiteralControl lc = new LiteralControl("&nbsp;&nbsp;"); 
 
                    linkButton1.Text = "" + (char)i; 
 
                    linkButton1.CommandName = "alpha"
                    linkButton1.CommandArgument = "" + (char)i; 
 
                    container.Controls.Add(linkButton1); 
                    container.Controls.Add(lc); 
                } 
 
                LiteralControl lcLast = new LiteralControl("&nbsp;"); 
                container.Controls.Add(lcLast); 
 
                LinkButton linkButtonAll = new LinkButton(); 
                linkButtonAll.Text = "All"
                linkButtonAll.CommandName = "NoFilter"
                container.Controls.Add(linkButtonAll); 
            } 
        } 
 

Basically, you need the GridCommandItem instead of the GridPagerItem. Add a container like a PlaceHolder and the link buttons within.

-Leon
0
Jon
Top achievements
Rank 1
answered on 23 Mar 2008, 12:50 PM
Cool
thanks!
0
Paul
Top achievements
Rank 1
answered on 03 Oct 2008, 11:11 AM
I'm using the command item approach to the alphabetic pager as above, but if you actually try it you'll find that it doesnt work.
1. Select a letter that returns multiple pages of data
2. Change the page
The page changes successfully, but the grid is being rebound and the alphabetic selection is removed. i.e. it goes back to "All" when you change pages.

Any ideas?
0
Pavel
Telerik team
answered on 06 Oct 2008, 08:14 AM
Hi Paul,

I am not sure I understand the problem correctly. However I have created a sample page which implements the suggested approach. It is behaving as expected on my end. Give it a try and let me know if I am leaving something out.

Sincerely yours,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
314
Top achievements
Rank 1
Leon
Top achievements
Rank 1
Jon
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Pavel
Telerik team
Share this question
or