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

Add controls to pager

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George Handlin
Top achievements
Rank 1
George Handlin asked on 30 Jan 2015, 03:14 PM
I'm trying to add a label and checkbox after the Page Size drop down in the standard pager. However, when I do this:

protected void AssetGrid_OnItemEvent(object sender, GridItemEventArgs e)
{
    if (e.EventInfo is GridInitializePagerItem)
    {
        var showAllLabel = new Label {Text = "Show All"};
        var showAllCheckBox = new CheckBox();
 
        (e.Item as GridPagerItem).PagerContentCell.Controls.Add(showAllLabel);
        (e.Item as GridPagerItem).PagerContentCell.Controls.Add(showAllCheckBox);
    }
}

The result is the controls above the whole pager. 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 04 Feb 2015, 10:09 AM
Hello George,

You can use the following approach to achieve the requested functionality:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        GridPagerItem pager = e.Item as GridPagerItem;
        RadComboBox combo = pager.FindControl("PageSizeComboBox") as RadComboBox;
        Panel cell = combo.Parent as Panel;
 
        Label showAllLabel = new Label { Text = "Show All" };
        CheckBox showAllCheckBox = new CheckBox();
 
        cell.Controls.Add(showAllLabel);
        cell.Controls.Add(showAllCheckBox);
    }
}

Hope this helps. Please give it a try and let me know if it works for 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.

 
Tags
Grid
Asked by
George Handlin
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or