Twitter style paging with ASP.NET MVC and jQuery
来源:互联网 发布:js修改url 不跳转 编辑:程序博客网 时间:2024/06/09 19:53
来源:http://joelabrahamsson.com/twitter-style-paging-with-aspnet-mvc-and-jquery/
public class HomeController : Controller{ private const int defaultEntryCount = 10; public ActionResult Index(int? entryCount) { if (!entryCount.HasValue) entryCount = defaultEntryCount; //Retrieve the first page with a page size of entryCount int totalItems; IEnumerable<Entry> entries = GetLatestEntries(1, entryCount.Value, out totalItems); if (entryCount < totalItems) AddMoreUrlToViewData(entryCount.Value); return View(entries); } private void AddMoreUrlToViewData(int entryCount) { ViewData["moreUrl"] = Url.Action("Index", "Home", new { entryCount = entryCount + defaultEntryCount }); }}
public ActionResult Index(int? entryCount){ if (!entryCount.HasValue) entryCount = defaultEntryCount; int totalItems; if(Request.IsAjaxRequest()) { int page = entryCount.Value / defaultEntryCount; //Retrieve the page specified by the page variable with a page size o defaultEntryCount IEnumerable<Entry> pagedEntries = GetLatestEntries(page, defaultEntryCount, out totalItems); if(entryCount < totalItems) AddMoreUrlToViewData(entryCount.Value); return View("EntryTeaserList", pagedEntries); } //Retrieve the first page with a page size of entryCount IEnumerable<Entry> entries = GetLatestEntries(1, entryCount.Value, out totalItems); if (entryCount < totalItems) AddMoreUrlToViewData(entryCount.Value); return View(entries);}
0 0
- Twitter style paging with ASP.NET MVC and jQuery
- Server-Side Paging with the Entity Framework and ASP.NET MVC 3
- Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application
- Integrating jQuery UI and ASP.NET MVC
- Custom Paging in ASP.NET 2.0 with SQL Server 2005
- ASP.NET MVC 3: Layouts and Sections with Razor
- Getting Started with NHibernate and ASP.NET MVC- CRUD Operations
- Upload files in ASP.NET MVC with JavaScript and C#
- TextBox AutoComplete with ASP.NET and jQuery UI
- Authorize attribute and jquery AJAX in asp.net MVC
- asp.net分页,Effective paging with List View control in ASP.NET
- ASP.NET SignalR with MVC
- 热门的技术教程!ASP.NET MVC, JQuery, ASP.NET AJAX and ADO.NET Entity Framework
- 热门的技术教程!ASP.NET MVC, JQuery, ASP.NET AJAX and ADO.NET Entity Framework
- MVC 5 with EF 6 in Visual Basic - Sorting, Filtering and Paging
- Multiple Files Upload in ASP.NET and ASP.NET with jQuery
- ASP.NET WebForm and ASP.NET MVC
- 在ASP.NET MVC 4中使用TWITTER BOOTSTRAP
- HDOJ 1879 继续畅通工程(并查集)
- 测试 Java 类的private和protected变量和方法
- IDEA 快捷键整理
- can't open include file "model.ice"
- 《JavaScript语言精粹》之部件
- Twitter style paging with ASP.NET MVC and jQuery
- Javascript单元测试框架比较Qunit VS Jasmine
- Extjs4.2 Grid Filter Feature 表格过滤特性
- 虚基类、抽象基类和接口
- 使用cppcms开发JSON_RPC服务:高级用法
- [水]ZOJ1539
- java war 打包、解压命令
- Fork/Join个人小结
- μC/OS-II邵贝贝节选