Edit, Update GridView Without Refreshing the Whole Page in Asp.Net

Leave a Comment
The GridView control provides built-in support for making callbacks to the server when a new sort order or page of data is requested by the user, and, in the process, retrieves the most recent data and updates the contents of the GridView, all without having to refresh the whole page.

All you have to do to implement this capability is to set the EnableSortingAndPagingCallbacks attribute of the GridView to True. ASP.NET handles everything else for you.

<asp:GridView ID="gvBooks" Runat="Server"
AllowPaging="true"
AllowSorting="true"
AutoGenerateColumns="false"
BorderColor="#000080"
BorderStyle="Solid"
BorderWidth="2px"
Caption=""
HorizontalAlign="Center"
Width="90%"
PageSize="5"
PagerSettings-Mode="Numeric"
PagerSettings-PageButtonCount="5"
PagerSettings-Position="Bottom"
PagerStyle-HorizontalAlign="Center"
PagerSettings-NextPageText="Next"
PagerSettings-PreviousPageText="Prev"
PagerStyle-CssClass="pagerText"
OnRowCreated="gvBooks_RowCreated"
EnableSortingAndPagingCallbacks="true" >

ASP.NET handles the partial page refresh for you by outputting client-side JavaScript to perform an asynchronous callback to the server and handle the callback when the updated data is returned from the server.

0 comments:

Post a Comment