Custom Search

Monday, June 16, 2008

Paging with AJAX

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:

Free Traffic

 Join My Community at MyBloglog! Blog Flux Directory 

Web Developement Blogs - BlogCatalog Blog Directory web development blog  Internet Blogs - Blog Top Sites 

Blog Directory 

Click Here for Free Traffic!

Link2Communion.com