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

Show All option on the pager

7 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dewang Shah
Top achievements
Rank 1
Dewang Shah asked on 26 Jan 2010, 02:46 PM
Hi,

Is there any way to have a "Show all" option on the pager for the Grid?

Thanks,
Dewang

7 Answers, 1 is accepted

Sort by
0
Accepted
Schlurk
Top achievements
Rank 2
answered on 26 Jan 2010, 02:56 PM
You'd have to create your own custom pager and implement the functionality yourself. For information on how to create your own pager you can read over the Setting pager template documentation article.
0
Dewang Shah
Top achievements
Rank 1
answered on 26 Jan 2010, 03:44 PM
Yes, I was hoping to avoid writing my own pager :-)
Looks like I might not have a choice though.

Thanks for that.
0
Schlurk
Top achievements
Rank 2
answered on 26 Jan 2010, 03:48 PM
You could always have an external button which disables paging - essentially making it a "Show All" but I'm not sure how it'll fit with your overall layout. If you're looking to integrate it into the pager I think the template is the way to go :)
0
Kaj Bonfils
Top achievements
Rank 1
answered on 22 Mar 2010, 08:27 PM
This approach works for me:

I set the pagesize for "All" to int.MaxValue. 

protected void ResultGrid_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridPagerItem) 
            { 
                RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox"as RadComboBox; 
 
                // The number of items shown when all is selected 
                int allRowsCount = int.MaxValue; 
                 
                // Remove duplicates 
                RadComboBoxItem duplicate = combo.Items.FindItemByValue(allRowsCount.ToString()); 
                if (duplicate != null
                { 
                    duplicate.Remove(); 
                } 
                 
                // Create a new item for showing all 
                RadComboBoxItem item = new RadComboBoxItem("All", allRowsCount.ToString()); 
                item.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID); 
                combo.Items.Add(item); 
 
                // Set the current pagesize as the selected value 
                combo.Items.FindItemByValue(grid.PageSize.ToString()).Selected = true
            } 

0
Rohan
Top achievements
Rank 1
answered on 11 Oct 2012, 03:07 PM
Hi all


protected void ResultGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridPagerItem)
            {
                RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox") as RadComboBox;
 
                // The number of items shown when all is selected
                int allRowsCount = int.MaxValue;
                 
                // Remove duplicates
                RadComboBoxItem duplicate = combo.Items.FindItemByValue(allRowsCount.ToString());
                if (duplicate != null)
                {
                    duplicate.Remove();
                }
                 
                // Create a new item for showing all
                RadComboBoxItem item = new RadComboBoxItem("All", allRowsCount.ToString());
                item.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
                combo.Items.Add(item);
 
                // Set the current pagesize as the selected value
                combo.Items.FindItemByValue(grid.PageSize.ToString()).Selected = true;
            }
}

This approach is not working when you click on " Add new Record "
it gives the exception

Specified argument was out of the range of valid values. Parameter name: value
and source of exception
Telerik.Web.UI.GridTableView.set_CurrentPageInde
0
Shinu
Top achievements
Rank 2
answered on 12 Oct 2012, 09:32 AM
Hi,

Try setting the MasterTableView property InsertItemPageIndexAction to ShowItemOnFirstPage as follows.

ASPX:
<MasterTableView  CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnFirstPage">

Thanks,
Shinu.
0
Rohan
Top achievements
Rank 1
answered on 12 Oct 2012, 01:22 PM
Hi Shinu ,

Thank for replay ,
but i want to use
grdDataView.MasterTableView.InsertItemPageIndexAction = GridInsertItemPageIndexAction.ShowItemOnCurrentPage;

to show the "Add new record " buttons user control on selected page ......

once again thanks for replay
Tags
Grid
Asked by
Dewang Shah
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Dewang Shah
Top achievements
Rank 1
Kaj Bonfils
Top achievements
Rank 1
Rohan
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or