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

RadGrid pagenumbers causing postback

1 Answer 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 05 Sep 2013, 07:35 PM
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.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 06 Sep 2013, 10:53 AM
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.
Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or