Pagination Summary of the brushless newest list added by MVC and jquery

Source: Internet
Author: User

1. the JS Code that is loaded by PAGE has two calling methods,
one is when the page client load is complete $ (function {..}) you need to set pageindex and pagesize for the call.
the other is called when you click paging navigation. The address of the paging navigation is the address that has been spliced and does not need to provide parameters.

function loadlatelytelrecord (pageindex, pagesize) {
var url = "";
var resid = $ ("# hresid "). val ();
If (pageindex> 0 & pagesize> 0) {
url = "/MVC/RMS/latelytelrecord? Pagesize = "+ pagesize +" & pageindex = "+ pageindex +" & resid = "+ resid +" & TMP = "+ math. random ();
}else {
url = $ (this ). ATTR ("href");
}

$ ("# Latelytrpanel"). Load (URL, function (){
$ ("# Ltrpager a"). Click (loadlatelytelrecord );
$ ("A. postvisitrecord"). Click (postvisitrecord );
});
Return false;
}

2. Action Code in the Controller

/// <Summary>
/// My recent phone records
/// </Summary>
/// <Param name = "pageindex"> </param>
/// <Param name = "pagesize"> </param>
/// <Returns> </returns>
Public actionresult latelytelrecord (INT pageindex, int pagesize, long resid)
{
Viewdata ["pageindex"] = pageindex;
Viewdata ["pagesize"] = pagesize;
Viewdata ["resid"] = resid;
VaR Pd = rmsmodel. getlatelytelrecord (pageindex, pagesize );
Return view (PD );
}

3. Corresponding view code. The href attribute of tag a in the paging navigation must be "/MVC/RMS /..."

 <%  @ Page Language  =  "  C #  "  Inherits =  "  System. Web. MVC. viewpage  "     %>  
<% @ Import namespace = "XXX . CRM. Model " %>
<%
VaR PD = Viewdata. Model As Pageddataset < List < Telrecordmodel > ;
VaR Paging = New F. Studio. Common. stringhelper. Paging ();
VaR pagesize = ( Int ) (Viewdata [ " Pagesize " ]);
VaR pageindex = ( Int ) (Viewdata [ " Pageindex " ]);
VaR resid = ( Long ) (Viewdata [ " Resid " ]);
String URL = String . Format ( " /MVC/RMS/latelytelrecord? Pageindex = {0} & pagesize = {1} & resid = {2} " , " {0} " , Pagesize, resid );
VaR pagingstr = Paging. navigate (PD. Total, pagesize, 5 , Pageindex, URL );
%>
< Table Class = "Bfxx" >
< Tr >
< Th Width = "5%" > Xxx </ Th >
< Th Width = "10%" > Xxx </ Th >
< Th Width = "15%" > Xxxx </ Th >
< Th Width = "10%" > Xxxx </ Th >
< Th Width = "20%" > Xxxx </ Th >
< Th Width = "20%" > Xxxx </ Th >
< Th Width = "20%" > Xxxx < IMG ALT = "Refresh" SRC = "/Webform/images/isync.png" Onclick = "Loadlatelytelrecord (1, <% = pagesize %> )" Style = "Cursor: hand; width: 22px; Height: 22px ;" > </ Th >
</ Tr >
<% Foreach (VAR item in PD. Data)
{ %>
< Tr >
< TD > <% = Item. Direction %> </ TD >
< TD > <% = Item. callingnum %> </ TD >
< TD > <% = Item. callednum %> </ TD >
< TD > <% = Item. Name %> </ TD >
< TD > <% = Item. btime %> </ TD >
< TD > <% = Item. etime %> </ TD >
< TD >
< Div ID = "Record" >
< Div ID = "Player" >

</ Div >
< Input Type = "Button" Onclick = "Play (this, '<% = item. PATH %>', '<% = item. recordid %> ')" Value = "Play" />
< A Href = "" Recordid = "<% = Item. recordid %>" Style = 'Display: inline ;' Class = "Postvisitrecord" > Post </ A >
</ Div >
</ TD >
</ Tr >
<% } %>
< Tr >
< TD Colspan = "7" ID = "Ltrpager" Class = "Pager" >
<% = Pagingstr %>
</ TD >
</ Tr >
</ Table >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.