开发者

Rad grid localization

开发者 https://www.devze.com 2023-03-15 17:25 出处:网络
How do i localize the text that is writt开发者_运维技巧en in the bottom when pagination is done in the radgrid. For Example text which displays the page number Page No. 1 2 3I\'m not sure in which con

How do i localize the text that is writt开发者_运维技巧en in the bottom when pagination is done in the radgrid. For Example text which displays the page number Page No. 1 2 3


I'm not sure in which context you use the RagGrid, but there is how I changed the pager strings for RagGrid in my ASP.NET project:

protected override void OnItemDataBound(GridItemEventArgs e)
{
    // Localize pager.
    if (e.Item is GridPagerItem)
    {
        var pager = (GridPagerItem)e.Item;
        var label = pager.FindControl("GoToPageLabel") as Label;

        if (label != null)
            label.Text = "Page #:";

        label = pager.FindControl("PageOfLabel") as Label;

        if (label != null)
            label.Text = string.Format(", total: {0}", label.Text.Substring(label.Text.IndexOf(' ')));

        label = pager.FindControl("ChangePageSizeLabel") as Label;

        if (label != null)
            label.Text = "Items per page:";

        var button = pager.FindControl("GoToPageLinkButton") as Button;

        if (button != null)
            button.Text = "Go to this page";

        button = pager.FindControl("ChangePageSizeLinkButton") as Button;

        if (button != null)
            button.Text = "Change page size";

        return;
    }

    base.OnItemDataBound(e);
}

I assuming that there is almost same way to do it for WinForms. Also you can subscribe to ItemDataBound event instead of overriding the protected method.


There are RadControls for various presentation frameworks, you should be more specific.

If you're using AJAX ASP.NET, it should be something along PagerTooltipFormatString in RadGrid.PagerStyle (see here).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号