ASP.NET+JQueryʵÏÖAJAXµÄ·ÖÒ³
AJAXµÄ·ÖÒ³£¬ÊµÏÖ˼·ÊÇ£º
¡¡¡¡1.ÀûÓÃ$.fn.extendÔÚJQuery¿ò¼ÜÏÂÀ©Õ¹pagerÀà
¡¡¡¡2.½«»ñÈ¡¼Ç¼×ÜÊýÓëÏàÓ¦Ò³¼Ç¼µÄºǫ́·½·¨£¬Ð´Ôڼ̳Ð×ÔIHttpHandlerÀàµÄHandler.ashx.csÀ࣬µ±È»Êµ¼ÊÉÏÓÃaspx.csÎļþдºǫ́·½·¨Ò²Ã»ÎÊÌ⣬µ«ÓÉÓÚ.ashx.csÎļþÎÞÐè´¦ÀíÒ³ÃæÖî¶àʼþÒò¶øЧÂʸü¸ß¡£
¡¡¡¡3.ÔÚ³ÊÏÖÒ³ÃæÉϼÓÔØpagerÀà
¡¡¡¡ÒÔÏÂÊÇʵÏֵĴúÂ룺
1.À©Õ¹pagerÀà:extend.js
(function($){ $.fn.extend({ pager: function(totalCount,options) { var opts = jQuery.extend({ pageSize:10, callback:function(){} }, options); return this.each(function(){ var panel = $(this); function pageCount(){ return Math.ceil(totalCount/opts.pageSize); } function selectPage(type){ return function(){ var page = parseInt($('#currentPage').val()); if(type=='first') $('#currentPage').val('1'); if(type=='last') $('#currentPage').val($('#totalCount').val()); if(type=='previous') { if ((page-1)==0) $('#currentPage').val('1'); else $('#currentPage').val(page-1); } if(type=='next') { if ((page+1)>parseInt($('#totalCount').val())) $('#currentPage').val($('#totalCount').val()); else $('#currentPage').val(page+1); } //go°´Å¥ if(type=='go'){ if(isNaN($('input.page-index').val())||$('input.page-index').val()=='') return false; var textIndex = parseInt($('input.page-index').val()); $('#currentPage').val(textIndex); if(textIndex < 1) $('#currentPage').val('1'); else if(textIndex > parseInt($('#totalCount').val())) $('#currentPag
Ïà¹ØÎĵµ£º
+++ Ò³Ãæ´úÂëÈçÏ£º
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="username" DataSourceID="SqlDataSource1"
PageSize="3">
<Columns>
  ......
function Ajax(url)
{
var m_xmlReq=null;
if(window.ActiveXObject)
{
try
{
m_xmlReq = new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e)
{
try{m_xmlReq = new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}
}
}
else if(window.XMLHttpRequest ......
1¡¢.NetµÄHTTPÇëÇó
.NETÓëASPµÄÔËÐлúÖÆÓкܴó²»Í¬.
ASPµÄÇëÇóÓëÏìÓ¦ÊÇ,ASPÒ³Ãæ±»ÇëÇó,È»ºóÖðÐнâÊÍ.ÊÇ»ùÓÚ¹ý³ÌµÄ.×î¶àÊÇ°üº¬ÁËÎļþ,ÐèÒªÏÈÒýÈëÎļþ°ÕÁË.
¶ø.Net,ÔÚÒ³Ãæ±»ÇëÇóºó,Ê×ÏÈÊǼÓÔØHTTP Module,Õâ²»ÊDZ¾ÎĵÄÖصã.È»ºóÔÙ¼ÓÔØHTTP
Handler.ÕâÒ²²»ÊDZ¾ÎĵÄÖصã.¼ÓÔصÄÕâÁ½Ïî,¶¼ÐèÒªÔÚWebconfigÎļþÖÐÅäÖÃ.´ó¼ÒÖªµÀ ......
ÏÈÏÂÔØ.net framework2.0ºÍASPAJAXExtSetup.msi
È»ºó°²×° ¼´¿ÉÔËÐÐ
Èç¹ûÐèÒª¿ª·¢AJAX
ÔòÒª°²×°VSºÍAjaxControlToolkit
ÔÚVS¹¤¾ßÏäÖÐн¨±êÇ© ....
.Net Framework 3.5 »·¾³ÏÂÇëÔĶÁ v3.5 »·¾³ÏÂÈçºÎ²¼Öà AJAX »·¾³¡£
ÕâÀïËù˵µÄ»·¾³ÊÇÖ¸°´·þÎñÆ÷¶ËʵÏÖ·½Ê½½øÐеÄÅäÖá£Ó¦¸Ã˵ֻҪ°²×°ÁË ASP.NET AJAX Extensions ¾Í¿É ......
ÎÒÏë×öÒ»¸ö¶àÖ¸±ê¶¯Ì¬²éѯ£¬ÇëÎÊÄÄλÐÖµÜ×ö¹ý£¬°ï¸ö棡¾ßÌåÒªÇóÊÇ:ÎÒ¿ÉÒÔËæÒâÑ¡ÔñÊý¾Ý¿â±íÖеÄÈκÎÒ»¸ö»ò¶à¸ö×ֶΣ¬È»ºó°ÑËûÃDzéѯ³öÀ´£¡ÎÒ»á×öµ¥Ö¸±í²éѯµÄ£¬µ«ÏÖÔÚ¹¦ÄÜÒªÒªÇó¶àÖ¸±ê¶¯Ì¬²éѯ£¡»áµÄ°ï¸öæ°¡@£¡¸Ðл֮ÖÁ£¡
ÀýÈçÎÒÏë²éÊý¾Ý¿â±íÖÐµÄ Óû§±àºÅ ÐÕÃû »òÕßÓû§±àºÅ ÐÕÃû Ê¡·Ý ÊÕÈë ²¢°Ñ¶ÔÓ¦µ ......