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 >