Hi,
I have added the code below to the ItemDataBound event of a grid for which I want users to be able to select 100 as the Page Size. This works, but now I find that when I select this new item the grid does not do a postback and refresh. Could you please advise?
Thanks
Chris
if (e.Item is GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
RadComboBoxItem extraItem = new RadComboBoxItem("100", "100");
if (!PageSizeCombo.Items.Contains(extraItem))
{
PageSizeCombo.Items.Add(extraItem);
}
}
I have added the code below to the ItemDataBound event of a grid for which I want users to be able to select 100 as the Page Size. This works, but now I find that when I select this new item the grid does not do a postback and refresh. Could you please advise?
Thanks
Chris
if (e.Item is GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
RadComboBoxItem extraItem = new RadComboBoxItem("100", "100");
if (!PageSizeCombo.Items.Contains(extraItem))
{
PageSizeCombo.Items.Add(extraItem);
}
}
6 Answers, 1 is accepted
0
Hi Chris,
If you want to customize the page size combobox, see the Shinu's post in this forum thread.
Kind regards,
Pavlina
the Telerik team
If you want to customize the page size combobox, see the Shinu's post in this forum thread.
Kind regards,
Pavlina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Chris
Top achievements
Rank 1
answered on 28 Feb 2011, 06:35 PM
Hi,
Thanks for the response, but isn't that essentially what I have done? The key line being:
RadComboBoxItem extraItem = new RadComboBoxItem("100", "100");
Thanks
Chris
Thanks for the response, but isn't that essentially what I have done? The key line being:
RadComboBoxItem extraItem = new RadComboBoxItem("100", "100");
Thanks
Chris
0
Hello Chris,
To achieve your goal you should add extra item as below:
C#:
Regards, Pavlina
the Telerik team
To achieve your goal you should add extra item as below:
C#:
RadComboBoxItem extraItem =
new
RadComboBoxItem(
"100"
,
"100"
);
extraItem.Attributes.Add(
"ownerTableViewId"
, RadGrid1.MasterTableView.ClientID);
Regards, Pavlina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Chris
Top achievements
Rank 1
answered on 04 Mar 2011, 11:51 AM
Hi Pavlina,
That worked nicely. Many thanks.
Regards,
Chris
That worked nicely. Many thanks.
Regards,
Chris
0

Bhupinder Singh
Top achievements
Rank 1
answered on 27 Oct 2011, 08:44 AM
Hi,
I have the same requirement as mentioned in the forum entry. The solution you suggested works fine except for one unwanted side effect. When I selected 100 as pagesize every thing works fine but the value shown in RadComboBox as selected is shown as 10 ( the first item of ComboBox). But the pagesize is 100 and when I click on forward or back pages the pagesize is still 100 but value shown in ComboBox is 10.
Regards,
Bhupinder
I have the same requirement as mentioned in the forum entry. The solution you suggested works fine except for one unwanted side effect. When I selected 100 as pagesize every thing works fine but the value shown in RadComboBox as selected is shown as 10 ( the first item of ComboBox). But the pagesize is 100 and when I click on forward or back pages the pagesize is still 100 but value shown in ComboBox is 10.
Regards,
Bhupinder
0

Princy
Top achievements
Rank 2
answered on 27 Oct 2011, 10:02 AM
Hello Bhupinder,
You can try the following code snippet in ItemCreated event to show the value in PageSizeComboBox same as that of selected page size.
C#:
Thanks,
Princy.
You can try the following code snippet in ItemCreated event to show the value in PageSizeComboBox same as that of selected page size.
C#:
protected
void
RadGrid1_ItemCreated(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
GridPagerItem pagerItem = (GridPagerItem)e.Item;
RadComboBox PageSizeCombo = (RadComboBox)pagerItem.FindControl(
"PageSizeComboBox"
);
RadComboBoxItem item1 =
new
RadComboBoxItem();
item1 =
new
RadComboBoxItem(
"100"
,
"100"
);
item1.Attributes.Add(
"ownerTableViewId"
, e.Item.OwnerTableView.ClientID);
PageSizeCombo.Items.Add(item1);
PageSizeCombo.Items.FindItemByValue(RadGrid1.PageSize.ToString()).Selected =
true
;
}
}
Thanks,
Princy.