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

setting PagerTextFormat from codebehind

8 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 08 Jul 2009, 11:24 AM

Why does this not work?

MyGrid.PagerStyle.PagerTextFormat = "blah blah {0} {1} {2} {3} {4} {5}";

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 08 Jul 2009, 11:59 AM
Hello Martin,

I suppose you are trying to customize your PagerText. If thats the case, then you can try the following format:
RadGrid1.PagerStyle.PagerTextFormat = "{4} custom text : {0} , {1} , {2} , {3} , {5}";

-Princy.
0
Martin
Top achievements
Rank 1
answered on 09 Jul 2009, 05:18 AM
No difference. I don't don't see why it would either. I use the same number of {n}'s (don't know what they are called).
0
Daniel
Telerik team
answered on 09 Jul 2009, 08:36 AM
Hello Martin,

Could you please provide more details about your scenario? Which pager format you use?

Please note that {4} is a special placeholder in this case. For your convenience I extracted a short quote from our documentation:

"{4}  |  Page {0} of {1}, items {2} to {3} of {5}

where '{4}' is the set of controls for the corresponding pager type (positioned on the left) and 'Page {0} of {1}, items {2} to {3} of {5}' is the text message displayed on the right which conforms to the same concepts as described above. "

Using PagerTextFormat

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Martin
Top achievements
Rank 1
answered on 14 Jul 2009, 12:37 PM

In the ascx the following format is used and displayed:
Change page: {4}  Side<strong>{0}</strong> af <strong>{1}</strong>, resultat <strong>{2}</strong> til <strong>{3}</strong> af <strong>{5}</strong>. 

Side means "page" in danish.

In Page_Load() I do this:
MyList.PagerStyle.PagerTextFormat = "Change page: {4}  Siiiiide<strong>{0}</strong> af <strong>{1}</strong>, resultat <strong>{2}</strong> til <strong>{3}</strong> af <strong>{5}</strong>."
 All I did was to add a lot of iiiii's to make sure that it made a difference. It doesn't. I don't understand why not.
0
Daniel
Telerik team
answered on 17 Jul 2009, 04:43 PM
Hello Martin,

Please find the attached demo that I created for you. Let me know if you have any questions.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Martin
Top achievements
Rank 1
answered on 22 Jul 2009, 10:52 AM

I copied this line from your project into my page load (changed radgrid name of course). Did not make any difference.

rgPropertyResultList.PagerStyle.PagerTextFormat = Server.HtmlDecode("Change page: {4}  Siiiiide<strong>{0}</strong> af <strong>{1}</strong>, resultat <strong>{2}</strong> til <strong>{3}</strong> af <strong>{5}</strong>."); 
0
Daniel
Telerik team
answered on 27 Jul 2009, 08:00 PM
Hello Martin,

I tried to reproduce the problem on my end, but unfortunately without avail. Attached to this post is a screenshot, that illustrates the behavior at our side. Could you please post the full declaration of your RadGrid here?

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eirik H
Top achievements
Rank 2
answered on 24 Sep 2012, 09:02 AM
I did it in itemDatabound, works like a charm:

Protected Sub reviewDG_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles reviewDG.ItemDataBound
    If TypeOf e.Item Is GridPagerItem Then
 
        Dim pager As GridPagerItem = DirectCast(e.Item, GridPagerItem)
        Dim lbl As Label = DirectCast(pager.FindControl("ChangePageSizeLabel"), Label)
        lbl.Text = WOLocalization.GetString("Page size") & ":"
 
        Me.reviewDG.MasterTableView.PagerStyle.PagerTextFormat = Server.HtmlDecode("{4} <strong>{5}</strong>observations in <strong>{1}</strong> pages")
    End If
End Sub

Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Martin
Top achievements
Rank 1
Daniel
Telerik team
Eirik H
Top achievements
Rank 2
Share this question
or