Bunch's Blog

One day I'll have a catchy subtitle, one day
posts - 87 , comments - 124 , trackbacks - 0

Tuesday, March 6, 2012

RadGrid PagerStyle in Code Behind

Recently I ran into an issue where the paging text in a RadGrid control needed to be customizable. In my case I was specifically looking at the "Page size" and "xx items in yy pages" text. Getting around it for the "Page size" was a snap. If your RadGrid is called rgTest one line would do it:

rgTest.PagerStyle.PageSizeLabelText = "your text here";

The "xx items in yy pages" was a bit trickier, but still handled in one line of code.

rgTest.PagerStyle.PagerTextFormat = "{4} {5} things in {1} my pages";

The tricky part was determining which items to use, there are five in total ({1} through {5}). The {4} needs to be first otherwise the rest will not show up. A good guide (but not for my particular situation) is found here.

Tags: ,

Posted On Tuesday, March 6, 2012 3:56 PM | Comments (0) |

Powered by: