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

Control Paging look in header/footer

4 Answers 359 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Max McKinney
Top achievements
Rank 1
Max McKinney asked on 29 Oct 2009, 05:45 PM
Hi,

I'm trying to customize the look of the pager.  I know I can create a pager template and set up custom look at feel with that.  The problem is that when you set the paging position to Top And Bottom it is exactly the same.  We are looking to have the top with some custom look/feel and the bottom to have a different look/feel.  I have not created the custom paging yet.  One solution would be for me to find a way to detect if the controls are in the header/footer pager and set visibility based on that.  Is this possible, or can I get a code snippet of how this can be done?  I attached a file to give an example of how we are planning to do our custom paging in the header and footer.  We have paging in the footer and we have setting the page size information in the header.

<telerik:RadGrid AutoGenerateColumns="false" ID="rgPermissions" DataSourceID="odsUserPermissionsTypes" 
            AllowFilteringByColumn="True" AllowSorting="True" ShowStatusBar="true"   
            AllowPaging="True" runat="server" GridLines="None"   
            onitemdatabound="rgPermissions_ItemDataBound" > 
            <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" /> 
            <GroupingSettings CaseSensitive="false" /> 
            <MasterTableView AutoGenerateColumns="false" AllowFilteringByColumn="True" ShowFooter="True" TableLayout="Auto">  
                  
                <Columns>                     
                    <telerik:GridBoundColumn DataField="CLIENT_TYPE" HeaderText="Client Type" SortExpression="CLIENT_TYPE" UniqueName="ClientType"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" /> 
                    <telerik:GridBoundColumn DataField="USER_ROLE_TYPE" HeaderText="User Role Type" SortExpression="USER_ROLE_TYPE" UniqueName="UserRoleType"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />                   
                    <telerik:GridTemplateColumn AllowFiltering="false">  
                        <itemstyle horizontalalign="Center" width="10px" /> 
                        <headerstyle width="10px" /> 
                        <ItemTemplate> 
                            <asp:LinkButton ID="lnkView" runat="server" CommandName="ViewRecord" Text="View"></asp:LinkButton>      
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn>                     
                </Columns>   
            </MasterTableView>                         
        </telerik:RadGrid> 

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 Oct 2009, 06:15 AM
Hello Max,

You can use the PagerTemplate for this purpose. You can place the controls that you want to display in your header PagerTemplate in one panel and that of the footer PagerTemplate in another panel and switch the visibility as shown below:
aspx:
<PagerStyle Position="TopAndBottom" /> 
 
<PagerTemplate> 
    <asp:Panel ID="Panel1" runat="server"
        Header pager controls  
    </asp:Panel> 
    <asp:Panel ID="Panel2" runat="server"
        Footer pager controls  
    </asp:Panel> 
</PagerTemplate> 

c#:
protected void RadGrid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridPagerItem) 
        { 
            GridPagerItem pagerItem = (GridPagerItem)e.Item; 
 
            if (pagerItem.NamingContainer is GridTHead) 
            { 
                pagerItem.FindControl("Panel2").Visible = false
                 
            } 
            else if (pagerItem.NamingContainer is GridTFoot) 
            { 
                pagerItem.FindControl("Panel1").Visible = false;                 
            } 
        } 
    } 

Thanks
Shinu.
0
Ram
Top achievements
Rank 1
answered on 14 Apr 2010, 06:02 PM
Hi,
Could you tell me if I could have a different custom pager on top and another on bottom and let them stay permanently. NOt switch between  their visibility. I.E Grid will always have a pager on top and different pager on bottom. Is it possible?
0
Maria Ilieva
Telerik team
answered on 19 Apr 2010, 11:33 AM
Hi Ramya,

Thank you for contacting us.

You could use the ItemCreated event of teh RadGrid and check if you are in top or bottom pager and customize it by design. Please refer to the following help topic which elaborates on creating custom pager.


Regards,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ram
Top achievements
Rank 1
answered on 21 Apr 2010, 08:54 PM
Thanks a lot
Tags
Grid
Asked by
Max McKinney
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ram
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or