4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 25 Nov 2009, 06:36 AM
Hello Avinash,
You can set the PagerMode for the grid as "Slider" and add pagesize controls to the slider panel of the pager item. Checkout the code below to add controls to the pager row and change grid pagesize as required.
CS:
-Shinu.
You can set the PagerMode for the grid as "Slider" and add pagesize controls to the slider panel of the pager item. Checkout the code below to add controls to the pager row and change grid pagesize as required.
CS:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridPagerItem) |
{ |
GridPagerItem pagerItem = (GridPagerItem)e.Item; |
Label lblPager = new Label(); |
lblPager.ID = "PageSizeLabel"; |
lblPager.Text = "| PageSize: "; |
RadComboBox combo = new RadComboBox(); |
combo.ID = "PageSizeComboBox"; |
combo.AutoPostBack = true; |
combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(combo_SelectedIndexChanged); |
// Adding items to combobox |
combo.Items.Add(new RadComboBoxItem("10")); |
combo.FindItemByText("10").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID); |
combo.Items.Add(new RadComboBoxItem("20")); |
combo.FindItemByText("20").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID); |
combo.Items.Add(new RadComboBoxItem("50")); |
combo.FindItemByText("50").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID); |
// Adding pagesize controls to slider's container |
((Panel)(pagerItem.FindControl("RadGrid1_SliderPagerLabel"))).Controls.Add(lblPager); |
((Panel)(pagerItem.FindControl("RadGrid1_SliderPagerLabel"))).Controls.Add(combo); |
// Setting combobox text |
combo.FindItemByText(RadGrid1.PageSize.ToString()).Selected = true; |
} |
} |
void combo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
RadGrid1.PageSize = Convert.ToInt32(((RadComboBox)o).SelectedItem.Text); |
RadGrid1.Rebind(); |
} |
-Shinu.
0

Avinash
Top achievements
Rank 2
answered on 27 Nov 2009, 07:26 AM
Hi Shinu,
Thanks...
It really helped a lot, appreciated.
Thanks,
Avi
Thanks...
It really helped a lot, appreciated.
Thanks,
Avi
0

rd
Top achievements
Rank 1
answered on 09 Apr 2014, 03:20 PM
Hello.
For me the code works great but only inside a Page, I'm trying to use it in a UserControl but without success.
Everytime I run, ((Panel)(pagerItem.FindControl("RadGrid1_SliderPagerLabel"))) is always null.
I'm loading the UserControl to a Placeholder inside my default page.
My Telerik.Web.UI version is 2013.3.1114.40.
For me the code works great but only inside a Page, I'm trying to use it in a UserControl but without success.
Everytime I run, ((Panel)(pagerItem.FindControl("RadGrid1_SliderPagerLabel"))) is always null.
I'm loading the UserControl to a Placeholder inside my default page.
My Telerik.Web.UI version is 2013.3.1114.40.
0
Hello,
I have already replied to your query in the following thread:
http://www.telerik.com/forums/page-size-selection-when-pagerstyle-mode-slider
I suggest that we continue our conversation on the mentioned thread to enable other developers with similar issues to track the discussion more easily.
Regards,
Eyup
Telerik
I have already replied to your query in the following thread:
http://www.telerik.com/forums/page-size-selection-when-pagerstyle-mode-slider
I suggest that we continue our conversation on the mentioned thread to enable other developers with similar issues to track the discussion more easily.
Regards,
Eyup
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.