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>
  ......
1¡¢.NetµÄHTTPÇëÇó
.NETÓëASPµÄÔËÐлúÖÆÓкܴó²»Í¬.
ASPµÄÇëÇóÓëÏìÓ¦ÊÇ,ASPÒ³Ãæ±»ÇëÇó,È»ºóÖðÐнâÊÍ.ÊÇ»ùÓÚ¹ý³ÌµÄ.×î¶àÊÇ°üº¬ÁËÎļþ,ÐèÒªÏÈÒýÈëÎļþ°ÕÁË.
¶ø.Net,ÔÚÒ³Ãæ±»ÇëÇóºó,Ê×ÏÈÊǼÓÔØHTTP Module,Õâ²»ÊDZ¾ÎĵÄÖصã.È»ºóÔÙ¼ÓÔØHTTP
Handler.ÕâÒ²²»ÊDZ¾ÎĵÄÖصã.¼ÓÔصÄÕâÁ½Ïî,¶¼ÐèÒªÔÚWebconfigÎļþÖÐÅäÖÃ.´ó¼ÒÖªµÀ ......
Ç°Ãæ¶Ôroute¡¢controller¡¢view ÒѾÓÐÁË»ù±¾µÄÁ˽⣬½ñÌìÎÒÃǾÍÀ´Ò»¸ö¼òµ¥µÄʵÀý -- Movie
¿ªÊ¼Ö®Ç°£¬¼òµ¥ËµÒ»Ï model(Ä£ÐÍ)£¬ÏàÐÅ´ó¼Ò×ö·Ö²ã¿ª·¢µÄʱºòÒ»¶¨ÓùýËü£¬MVCµÄmodelºÍËûÒ»Ñù£¬
ÿһ¸ömodel ¶ÔÓ¦Êý¾Ý¿âÒ»ÕÅ±í£¬ÕâÑùÎÒÃǾÍÊÇÓÃmodelµÄÊôÐÔ·ÃÎʱíÖÐÿһÐмǼµÄijһÁÐÖµ¡£
mvcÖÐÄã¿ÉÒÔ×Ô¼ºÐ´model£¬Ò²¿ÉÒÔʹ ......
ÉÏ´Îд¹ýһƪMVC·ÖÒ³µÄ
×Ô¼ºÓõÄÒ»¸öASP.Net MVC·ÖÒ³ÄóöÀ´·ÖÏíÏÂ
ÏÖÔÚ·¢Ò»¸ö¸Ä½ø°æ
ÀïÃæÓõ½µÄIPagedListÎÒ×Ô¼ºÒ²¼Ç²»ÇåÊÇ´ÓÄÄÀïCOPYÀ´µÄÁË¡£ºÇºÇ
ÕâÀïÎҾͲ»°ÑIPagedListµÄ´úÂëÌù³öÀ´ÁË£¬ÒªÊ¹µÄÏÂÔØDEMO×Ô¼ºÄðɡ£
ºǫ́¶ÔÊý¾ÝµÄ·ÖÒ³
public ActionResult Index([DefaultValue(1)]int p,[DefaultValue(10)]int pages ......
ASP.NETÖеÄEval£¨£©ºÍDataBinder.Eval£¨£©·½·¨
2009-12-12 17:55
Eval( " ")ºÍBind( " ")¡¡ÕâÁ½ÖÖÒ»¸öµ¥Ïò°ó¶¨£¬Ò»¸öË«Ïò°ó¶¨
bindÊÇË«Ïò°ó¶¨,µ«ÐèÊý¾ÝÔ´¿É¸ü¸Ä²ÅÄÜÓÃ
ASP.NET 2.0¸ÄÉÆÁËÄ£°åÖеÄÊý¾Ý°ó¶¨²Ù×÷£¬°Ñv1.xÖеÄÊý¾Ý°ó¶¨Óï·¨DataBinder.Eval(Container.DataItem, fieldname)¼ò»¯ÎªEval(fieldname)¡£Eval·½· ......