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

Numeric Pager in PagerTemplate

1 Answer 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Velkumar
Top achievements
Rank 2
Velkumar asked on 14 Apr 2011, 07:04 AM
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" />                                       
            </ClientSettings>
            <MasterTableView AllowPaging="true">
                <PagerTemplate>
                    <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">
                            </telerik:RadComboBox
                        </div>                                         
                       <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" />
                            </telerik:RadNumericTextBox>
                            <span style="vertical-align: middle;font-size:8pt;">of
                                <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                            </span>
                            <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" />                                                                                                      
                       </div>  
                       <asp:Panel runat="server" ID="NumericPagerPlaceHolder"/>                                                                                                                                                                                                                   
                    </asp:Panel>
                </PagerTemplate>
            </MasterTableView>
            <HeaderStyle Font-Size="8pt" />                                                                               
        </telerik:RadGrid>
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)
        {
            try
            {
                 
                    if (e.Item is GridPagerItem)
                    {
                        GridPagerItem gridPager = e.Item as GridPagerItem;
                        Control NumericPagerPlaceHolder = gridPager.GetNumericPager();
                         
                        Control placeHolder = gridPager.FindControl("NumericPagerPlaceHolder");
                        placeHolder.Controls.Add(NumericPagerPlaceHolder);
                    }
                    
                 
            }
            catch (Exception)
            { }
        }

Please give me the solution  for this problem.

Thanks,
Velkumar.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 19 Apr 2011, 12:55 PM
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,
Iana
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
Grid
Asked by
Velkumar
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Share this question
or