CurrentPageText changed by using C# code in RadDataPager

4 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    7 posts
    Member since:
    Jul 2011

    Posted 09 Sep 2011 Link to this post

    Hi,

    I want to chance CurrentPageText text property by using c# code. i am using

        <telerik:RadDataPager ID="RadDataPager3" runat="server" PagedControlID="RadListView1"
                                                    PageSize="9" Skin="">
                                                    <Fields>
                                                        <telerik:RadDataPagerGoToPageField CurrentPageText="Page:"
                                                            TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="15" />
                                                    </Fields>
                                                </telerik:RadDataPager>

    code and now i want to change text of CurrentPageText, TotalPageText and SubmitButtonText by using C# code.

    It can be feasible or not?

    Thanks...
  2. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 14 Sep 2011 Link to this post

    Hi Gaurav,

    It would be a little tricky to change these texts from the server because of their current implementation. It would be quite easier to use jQuery in order to set them when the page loads:
    <script type="text/javascript">
        function pageLoad() {
            $telerik.$(".rdpPagerLabel")[0].innerHTML = "Custom1";
            $telerik.$(".rdpPagerLabel")[1].innerHTML = "Custom2";
            $telerik.$(".rdpPagerButton")[0].value = "Custom3";
        }
    </script>


    Regards,
    Tsvetina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gaurav
    Gaurav avatar
    7 posts
    Member since:
    Jul 2011

    Posted 14 Sep 2011 Link to this post

    This is a great logic and i did this already in a another way but my client wants to change these values by using C# code. He didn't want take javascript code to do this.
  5. Tsvetina
    Admin
    Tsvetina avatar
    1873 posts

    Posted 16 Sep 2011 Link to this post

    Hello Gaurav,

    With the current implementation of RadDataPager this cannot be changed on the server. The thing is that the values are being set directly to the literals rendered by the field in a very early stage of the pager creation and there is no API for chaning them later.

    You could build a template field and set its values through server code, e.g.:
    protected void RadDataPager1_PageIndexChanged(object sender, RadDataPagerPageIndexChangeEventArgs e)
    {
        RadDataPager pager = sender as RadDataPager;
        foreach (RadDataPagerFieldItem item in pager.Controls)
        {
            if (item.Field is RadDataPagerTemplatePageField)
            {
                Label lbl = item.FindControl("CurrentPageLabel") as Label;
                lbl.Text = "Test";
            }
        }
    }


    Greetings,
    Tsvetina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Back to Top