9 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 10 May 2010, 07:54 AM
Hi Martillo,
Try the following code to add page size selection control to the pager item when the PagerStyle-Mode is "Slider".
Regards,
Princy.
Try the following code to add page size selection control to the pager item when the PagerStyle-Mode is "Slider".
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(); |
} |
Regards,
Princy.
0

Martillo
Top achievements
Rank 2
answered on 10 May 2010, 03:26 PM
Hello Princy,
Thank you for the code. It looks good, however I'm getting a null reference error on the following line:
When I search the HTML source, I can find the ID:
I will work on debugging this later...
Thanks again,
Martillo
Thank you for the code. It looks good, however I'm getting a null reference error on the following line:
((Panel)(pagerItem.FindControl("RadGrid1_SliderPagerLabel"))).Controls.Add(lblPager); |
When I search the HTML source, I can find the ID:
div id="ctl00_ContentPlaceHolder_RadGrid1_ctl00_ctl02_ctl00_ctl00_ContentPlaceHolder_RadGrid1_SliderPagerLabel" class="rgSliderLabel"> |
I will work on debugging this later...
Thanks again,
Martillo
0

Ram
Top achievements
Rank 1
answered on 23 Aug 2011, 12:41 PM
Hi
I'm using radgrid in my application.
I have palced the radgrid inside asp:udatepanel.
When I load page first time the slider of radggrid not proper in appearence.in "Firefox"
Its like in attached file.
Its happen only first time. If do paging then its ok, but when I first generate the report its happeings.
please help me
I'm using radgrid in my application.
I have palced the radgrid inside asp:udatepanel.
When I load page first time the slider of radggrid not proper in appearence.in "Firefox"
Its like in attached file.
Its happen only first time. If do paging then its ok, but when I first generate the report its happeings.
please help me
0

Princy
Top achievements
Rank 2
answered on 23 Aug 2011, 01:03 PM
Hello Ram,
I cannot reproduce the issue at my end. 2011, 1, 315, 35 is the version in which I tested and it worked as expected.
Thanks,
Princy.
I cannot reproduce the issue at my end. 2011, 1, 315, 35 is the version in which I tested and it worked as expected.
Thanks,
Princy.
0

Ram
Top achievements
Rank 1
answered on 23 Aug 2011, 02:05 PM
My version is 2011.1.519.40
How cloud I solve this problem.
I have placed the grid in side asp:updatepanel for updating conditionally on button click event.
How cloud I solve this problem.
I have placed the grid in side asp:updatepanel for updating conditionally on button click event.
0

Welch
Top achievements
Rank 1
answered on 09 Jul 2013, 08:21 PM
Martillo,
What did you do to resolve the null reference error?
What did you do to resolve the null reference error?
0
Hi Welch,
I am attaching a sample RadGrid web site to demonstrate how you can add new controls to the slider pager item. Please run the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
I am attaching a sample RadGrid web site to demonstrate how you can add new controls to the slider pager item. Please run the attached application and let me know if it helps you.
Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

rd
Top achievements
Rank 1
answered on 09 Apr 2014, 03:19 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,
Can you please check the approach demonstrated in the RadGridPagerTemplateSlider.zip and let me know about the result?
Looking forward to hearing from you.
Regards,
Eyup
Telerik
Can you please check the approach demonstrated in the RadGridPagerTemplateSlider.zip and let me know about the result?
Looking forward to hearing from you.
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.