Numeric Pager in PagerTemplate

2 posts, 0 answers
  1. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 14 Apr 2011 Link to this post

    Hello ,

            I have a RadGrid in my page. The PagerItems are created using PagerTemplate.. I have asp buttons, ComboBox, RadNumerictextbox and a NumericPager. The code for pagertemplate is described below. I am using an ASP Panel for placing NumerPager in Pagertemplate.
    <telerik:RadGrid ID="radgdSuccessionList" runat="server"   Font-Names="Verdana"  Skin="Marzar" EnableEmbeddedSkins="false" AutoGenerateColumns="False"  AllowMultiRowSelection="true"  >
                <ClientSettings  EnablePostBackOnRowClick="false" >
                    <Selecting AllowRowSelect="True" />                                       
                <MasterTableView AllowPaging="true">
                        <asp:Panel ID="PagerPanel" Style="padding: 6px" runat="server">
                            <div style="float: left">
                                <span style="margin-top: 2px; float: left; margin-right: 3px;font-size:8pt;">Page size:</span>
                                <telerik:RadComboBox Skin="Office2007" ID="RadComboBox1" DataSource="<%# new object[]{10, 20, 30, 40, 50} %>"
                                    Style="margin-top: 2px;float: left; vertical-align: baseline; margin-right: 20px; text-align:center; height:25px"
                                    Width="40px" SelectedValue='<%# DataBinder.Eval(Container, "Paging.PageSize") %>'
                                    runat="server" OnClientSelectedIndexChanged="RadComboBox1_SelectedIndexChanged1" CssClass="CustomCssClass">
                           <div style="margin: 0px; float: right;"></div>                                                                                                                                                                                           
                           <div style="margin: 0px; padding: 0px; float: left; margin-right: 10px; white-space: nowrap;">
                                <asp:Button ID="Button1" runat="server" OnClientClick="changePage1('first'); return false;"
                                    CommandName="Page" CommandArgument="First" CssClass="PagerButton FirstPage" />
                                <asp:Button ID="Button2" runat="server" OnClientClick="changePage1('prev'); return false;"
                                    CommandName="Page" CommandArgument="Prev" CssClass="PagerButton PrevPage" />
                                <span style="vertical-align: middle;font-size:8pt;">Page:</span>
                                <telerik:RadNumericTextBox ID="RadNumericTextBox1" Skin="Office2007" Width="25px" Font-Size="8pt"
                                    Value='<%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>'
                                    runat="server" EnabledStyle-HorizontalAlign="Center" >
                                    <ClientEvents OnValueChanged="RadNumericTextBox1_ValueChanged1" />
                                    <NumberFormat DecimalDigits="0" />
                                <span style="vertical-align: middle;font-size:8pt;">of
                                    <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                                <asp:Button ID="Button3" runat="server" OnClientClick="changePage1('next'); return false;"
                                    CommandName="Page" CommandArgument="Next" CssClass="PagerButton NextPage" />
                                <asp:Button ID="Button4" runat="server" OnClientClick="changePage1('last'); return false;"
                                    CommandName="Page" CommandArgument="Last" CssClass="PagerButton LastPage" />                                                                                                      
                           <asp:Panel runat="server" ID="NumericPagerPlaceHolder"/>                                                                                                                                                                                                                   
                <HeaderStyle Font-Size="8pt" />                                                                               
    In the ItemCreated event function i have created the Numericpager.  Following code describe that functionality. I also attached a screen shot about that pager.  Now i come to my problem,  I want to handle the click events of that Pager. When i click the page numbers(1 2 3 4) i want to do some process. How can i handle this events from client side using javascript and from server side using C#
    void radgdSuccessionList_ItemCreated(object sender, GridItemEventArgs e)
                        if (e.Item is GridPagerItem)
                            GridPagerItem gridPager = e.Item as GridPagerItem;
                            Control NumericPagerPlaceHolder = gridPager.GetNumericPager();
                            Control placeHolder = gridPager.FindControl("NumericPagerPlaceHolder");
                catch (Exception)
                { }

    Please give me the solution  for this problem.

  2. Iana Tsolova
    Iana Tsolova avatar
    3388 posts

    Posted 19 Apr 2011 Link to this post

    Hi Velkumar,

    What types of controls are the numeric pager buttons? You should be able to handle the OnClientClick or onclick client-side event of the button and there use either the page() or fireCommand() client-side method to implement paging for the grid. However, note that if the grid is bound server-side, a postback will be initiated in all cases when the page command is performed.

    Kind regards,
    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