We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

 We generally use a GridView Control to Display Data and also Perform Paging, Sorting, Editing, Deleting records. In each of these we have postback on the page.

To avoid Postback during sorting and Paging, the following code can be used inside the GridView Control.

 If you have created a GridView and Bind the GridView using data source control, you can avoid postback during sorting and paging by setting EnableSortingAndPagingCallbacks' property of the GridView to True.

N:B: when you use the 'EnableSortingAndPagingCallbacks' property to true for avoid Postback, you cannot use Template Fields in the GridView.

Ex:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowSorting = "true"

 DataSourceID="SqlDataSource1" EnableSortingAndPagingCallbacks = "true">

 <Columns>

  <asp:BoundField DataField="FIRST_NAME" HeaderText="First Name"

                    SortExpression="FIRST_NAME" />

  <asp:BoundField DataField="LAST_NAME" HeaderText="Last Name"

                    SortExpression="LAST_NAME" />

  <asp:BoundField DataField="ADDRESS" HeaderText="Address"

                    SortExpression="ADDRESS" />

 </Columns>                 

</asp:GridView>


Related Tags:

ASP.NET

Author: Surama Hotta

top

ASP.NET

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login