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

CurrentPageText changed by using C# code in RadDataPager

3 Answers 75 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 09 Sep 2011, 12:00 PM
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...

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 14 Sep 2011, 09:50 AM
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
0
Gaurav
Top achievements
Rank 1
answered on 14 Sep 2011, 10:12 AM
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.
0
Tsvetina
Telerik team
answered on 16 Sep 2011, 11:22 AM
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
Tags
DataPager
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Gaurav
Top achievements
Rank 1
Share this question
or