RadGrid pagenumbers causing postback

2 posts, 0 answers
  1. John
    John avatar
    7 posts
    Member since:
    Jul 2013

    Posted 05 Sep 2013 Link to this post

    Hi,

    I have a radgrid on my page which has page numbers enabled. I am using Ajax Rad Manager for stopping postback. However, its not working which I click the page numbers of the grid. When I click the grid it is making a postback and loading the grid again.

    Can someone tell me how to stop the page numbers from loading whole page?

    Please let me know if you have any questions.

    Thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Sep 2013 Link to this post

    Hi John,

    As for RadGrid operations such as paging, I am afraid you cannot prevent the grid from doing a post-back or an ajax request as it needs to rebind itself in order for those operations to be completed. You can use ajax to achieve a seamless updating of the user interface by wrapping the grid in a RadAjaxPanel or using the RadAjaxManager control. Please check the following sample code i tried.

    ASPX:
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
        <telerik:RadGrid ID="RadGrid1" runat="server"
            AllowPaging="True" Width="97%" DataSourceID="SqlDataSource1">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="EmployeeID" ClientDataKeyNames="EmployeeID"
                Width="100%" CommandItemDisplay="Top" PageSize="5">
                <Columns>
                    <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" ReadOnly="True"
                        SortExpression="EmployeeID" UniqueName="EmployeeID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName"
                        UniqueName="FirstName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName"
                        UniqueName="LastName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title"
                        UniqueName="Title">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn">
                        <ItemTemplate>
                            <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString35 %>"
        SelectCommand="SELECT [EmployeeID], [FirstName], [LastName], [Title] FROM [Employees]">
    </asp:SqlDataSource>

    Thanks,
    Princy.
Back to Top