After I give example how to using GridView control in my last post, now I give a simple example how to sorting using AJAX with GridView Control.
By default, whenever we click a column header to sort the rows contained in a GridView, the page containing the GridView is posted back to the server. When sorting records with the GridView control, we can avoid posting the entire page back to the server by taking advantage of AJAX (Asynchronous JavaScript and XML).
we enable AJAX by including the EnableSortingAndPagingCallbacks property when declaring the GridView
By default, whenever we click a column header to sort the rows contained in a GridView, the page containing the GridView is posted back to the server. When sorting records with the GridView control, we can avoid posting the entire page back to the server by taking advantage of AJAX (Asynchronous JavaScript and XML).
we enable AJAX by including the EnableSortingAndPagingCallbacks property when declaring the GridView
for 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">
< id="Head1" runat="server">
<>AJAX Sorting Example< /title>
< /head>
<>
< id="form1" runat="server">
<>
< %= DateTime.Now.ToString("T") %>
< id="grdStudent" datasourceid="srcStudent" allowsorting="true" enablesortingandpagingcallbacks="true" runat="server">
< id="srcStudent" connectionstring="">"
SelectCommand="SELECT id,name,address,phone FROM student"
Runat="server" />
< /div>
< /form>
< /body>
< /html>
No comments:
Post a Comment