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

Radgrid PagerTextFormat Only Alters Bottom Elements of Grid and Not Top Elements

9 Answers 197 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 05 Jul 2012, 09:23 PM
I was trying to Localize my Radgrid the "x items in y pages" and I was able to use ContactGrid.PagerStyle.PagerTextFormat = "{4}{3} " + ItemsInText + " {2} " + PagesText; but only the bottom text changes, while the top text remains the same. Any Suggestions?

9 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 10 Jul 2012, 02:17 PM
Hello Dennis,

I have created a sample RadGrid web site to test the described behavior. On my side everything works as expected and the top pager item is being modified as well. Please find the attached application and let me know if I am missing something out to reproduce the issue.

Meanwhile, you could try to define your desired text formatting on design-time:
Copy Code
<PagerStyle PagerTextFormat="{4} {1} Pages Total. Showing items {2} to {3} of {5:0,0} total." />

Additionally, please check out the following help topic to understand in depth how to use pager item text formatting:
Grid / Using PagerTextFormat

Kind regards,
Eyup
the Telerik team
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 their blog feed now.
0
Dennis
Top achievements
Rank 1
answered on 10 Jul 2012, 04:21 PM
Thanks Eyup

Worked perfectly
0
Dennis
Top achievements
Rank 1
answered on 10 Jul 2012, 04:21 PM
Thanks Eyup

Worked perfectly
0
NTR
Top achievements
Rank 1
answered on 19 Sep 2012, 09:08 PM
I was trying to write code in "OnPageIndexChanged="RadGrid1_PageIndexChanged" but its saying error. How can i see page 2 rows.Can you please let me know.
0
Eyup
Telerik team
answered on 24 Sep 2012, 08:54 AM
Hi Harry,

I am afraid it is difficult to figure out your exact requirement from the provided information so far.

Could you please elaborate some more on the issue? What exactly do you want to achieve and what code do you implement in the mentioned OnPageSizeIndexChanged event? Could you please describe the error?

All the best,
Eyup
the Telerik team
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 their blog feed now.
0
NTR
Top achievements
Rank 1
answered on 24 Sep 2012, 01:17 PM

 

Server Error in '/' Application.

Compilation Error

 

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.pages_dashboard_aspx' does not contain a definition for 'rgDBDetails_PageIndexChanged' and no extension method 'rgDBDetails_PageIndexChanged' accepting a first argument of type 'ASP.pages_dashboard_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 171:                    <br />
Line 172:                    <div id="divrgDBDetails" runat="server">
Line 173: <telerik:RadGrid ID="rgDBDetails" runat="server" AutoGenerateColumns="False" OnPageIndexChanged="rgDBDetails_PageIndexChanged"Line 174:                            CellSpacing="0" GridLines="None" CssClass="RadGrid_CBGrid" Skin="Metro" FooterStyle-BorderColor="Black"
Line 175:                            ShowFooter="True" AllowPaging="true" PageSize="15" AllowMultiRowSelection="true"

0
Eyup
Telerik team
answered on 27 Sep 2012, 10:02 AM
Hello Harry,

You will need to attach a server side handler for the defined PageIndexChanged event:
protected void rgDBDetails_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
    // execute custom logic here
}

That should do the trick. Please give it a try and let me know about the result.

Regards,
Eyup
the Telerik team
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 their blog feed now.
0
Tayyab Asghar
Top achievements
Rank 1
answered on 27 Sep 2012, 12:35 PM
the code
<PagerStyle PagerTextFormat="{4} {1} Pages Total. Showing items {2} to {3} of {5:0,0} total." /> 


it works for me but i want it in code behind (.cs) because i want to put some condition in that as i have done and put condition for bottom text paging as below and its working for me only for bottom paging text
 protected void RadGridContract_ItemDataBound(object sender, GridItemEventArgs e)
        {
 if (e.Item is GridPagerItem )
            {
  int totalitems= (e.Item as GridPagerItem).Paging.DataSourceCount;
                 int totalpages = (e.Item as GridPagerItem).Paging.PageCount;
                 string itemslabel = totalitems > 2 ? " resultater på " : "resultat ";
                 string totalpageslabel = totalitems > 2 ? " sider" : " side ";
                 if (RadGridContract.PagerStyle.Position == GridPagerPosition.TopAndBottom)
                 {
                     //GridPagerItem pagerItem = (GridPagerItem)RadGridContract.MasterTableView.GetItems(GridItemType.Pager)[0];
                     RadGridContract.PagerStyle.PagerTextFormat = "{4} " + totalitems + itemslabel + " {1} " +
                                                                  totalpageslabel ;
                 }
}
}
how to achieve this for top paging text.
0
Eyup
Telerik team
answered on 02 Oct 2012, 07:23 AM
Hello Tayyab,

Could you please try the following approach?
protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
{
    if (e.EventInfo is GridInitializePagerItem)
    {
        GridPagingManager manager = (e.EventInfo as GridInitializePagerItem).PagingManager as GridPagingManager;
        int totalItems = manager.DataSourceCount;
        int totalPages = manager.PageCount;
 
        string itemsLabel = totalItems > 2 ? " resultater på " : "resultat ";
        string totalPagesLabel = totalPages > 2 ? " sider" : " side ";
 
        if (RadGrid1.PagerStyle.Position == GridPagerPosition.TopAndBottom)
        {
            RadGrid1.PagerStyle.PagerTextFormat = "{4} " + totalItems + itemsLabel + " {1} " + totalPagesLabel;
        }
    }
}

I hope this will prove helpful. Please give it a try and let me know about the result.

Additionally, you could check out the link provided in my first post.

Greetings,
Eyup
the Telerik team
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 their blog feed now.
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Dennis
Top achievements
Rank 1
NTR
Top achievements
Rank 1
Tayyab Asghar
Top achievements
Rank 1
Share this question
or