Now I give example how to use AJAX for paging though data. When working with a large number of database rows, it is useful to be able to display the rows in different pages. The default behavior of the GridView control is to post back to the server each and every time we navigate to a new page of records. However, there is an alternative. we can take advantage of AJAX (Asynchronous JavaScript and XML) when paging through records with the GridView control.
Code Example :
< %@ Page Language="VB" %>
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
< xmlns="http://www.w3.org/1999/xhtml">
< head id="Head1" runat="server">
< title >AJAX Page Example< /title>
< /head>
< body>
< form id="form1" runat="server">
< div>
< id="grdStd" datasourceid="srcStudent" allowpaging="true" enablesortingandpagingcallbacks="true" pagesize="5" runat="server">
< id="srcStudent" connectionstring="">"
SelectCommand="SELECT id,name,address FROM student"
Runat="server" />
< /div>
< /form>
< /body>
< /html>
Same with example that I explain in Sorting With AJAX, it includes an EnableSortingAndPagingCallbacks property that is assigned the value true. This property enables AJAX.
No comments:
Post a Comment