search
HomeWeb Front-endJS TutorialJS Ajax Jquery implements page refresh-free paging and grouping, super powerful implementation

<%@ Page language="c#" Codebehind="GroupText.aspx.cs" AutoEventWireup="false" 
Inherits="test1.GroupText" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
4.0 Transitional//EN" > 
<HTML> 
    <HEAD> 
        <title>GroupText</title> 
        <meta 
name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> 
        <meta name="CODE_LANGUAGE" Content="C#"> 
        <meta 
name="vs_defaultClientScript" content="JavaScript"> 
        <meta 
name="vs_targetSchema" 
content="http://schemas.microsoft.com/intellisense/ie5"> 
        <LINK 
href="css/wmh.css" href="css/wmh.css" type="text/css" rel="stylesheet"> 
        <script src="js/jquery.js" 
type="text/javascript"></script> 
        <script 
src="js/Common.js" type="text/javascript"></script> 
        <script src="js/getCommonTable.js" 
type="text/javascript"></script> 
        <script 
src="js/GroupText.js" type="text/javascript"></script> 
        <script language="javascript"><!-- 
        var ecid = 
&#39;100001&#39;; 
        var jpstr = ""; 
        var pageSize = 8; 

         
// --></script> 

    </HEAD> 
    <body MS_POSITIONING="GridLayout"> 
        <form id="Form1" 
method="post" runat="server"> 
            <div class="listDiv" 
style="height:100%; PADDING-TOP: 2px"> 
                <table 
cellSpacing="0" cellPadding="0" width="100%" border="0"> 
                    <tr class="dg_header"> 
                        <td style="BORDER-RIGHT: 1px solid; BORDER-TOP: 
1px solid; BORDER-LEFT: 1px solid; WIDTH: 10%; BORDER-BOTTOM: 1px solid; 
TEXT-ALIGN: center" >活动名称</td> 
                        <td 
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; WIDTH: 10%; 
BORDER-BOTTOM: 1px solid; TEXT-ALIGN: center">发送方</td> 
                        <td style="BORDER-RIGHT: 1px solid; BORDER-TOP: 
1px solid; WIDTH: 10%; BORDER-BOTTOM: 1px solid; TEXT-ALIGN: 
center">接收方</td> 
                        <td 
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; WIDTH: 12%; 
BORDER-BOTTOM: 1px solid; TEXT-ALIGN: center">发送时间</td> 
                        <td style="BORDER-RIGHT: 1px solid; BORDER-TOP: 
1px solid; WIDTH: 38%; BORDER-BOTTOM: 1px solid; TEXT-ALIGN: 
center">发送内容</td> 
                        <td 
style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; WIDTH: 10%; 
BORDER-BOTTOM: 1px solid; TEXT-ALIGN: center">积分</td> 
                        <td style="BORDER-RIGHT: 1px solid; BORDER-TOP: 
1px solid; WIDTH: 10%; BORDER-BOTTOM: 1px solid; TEXT-ALIGN: 
center">状态</td> 
                    </tr> 
                    <tr> 
                        <td 
class="dg_line" style="BORDER-BOTTOM: 0px solid" style="BORDER-BOTTOM: 0px 
solid" vAlign="top" width="100%" colSpan="7" 
                            height="100%"> 
                            <div id="divcontent" style="WIDTH: 100%; 
HEIGHT: 100%" align="left"></div> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td 
class="dg_line" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; 
BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" style="BORDER-RIGHT: 1px 
solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid" 
                            width="100%" colSpan="10"> 
                            <table width="100%"> 
                                <tr> 
                                    <td class="pgtext">共<span 
id="recordcount" style="COLOR: red" style="COLOR: red">0</span>条记录    
                                        目前第<span id="curpageindex" 
style="COLOR: red" style="COLOR: red">0</span> <font 
color="red">/</font><span id="pgcount" style="COLOR: red" 
style="COLOR: red">0</span>页    
                                        <input class="pageText" 
id="gototxt" type="text" maxLength="10" name="gototxt" runat="server"> 
                                        <input id="gotopg" type="button" 
class="goBtn"></td> 
                                    <td 
align="right"><img src="/static/imghwm/default1.png"  data-src="Images/first.gif"  class="lazy"  id="btnfirst"   style="max-width:90%" style="CURSOR: hand" 
alt="首页" > 
                                        <img src="/static/imghwm/default1.png"  data-src="Images/btn_pre.gif"  class="lazy"  id="btnpre" style="CURSOR: 
hand" style="CURSOR: hand" alt="上一页"  > <img src="/static/imghwm/default1.png"  data-src="Images/btn_next.gif"  class="lazy"  
id="btnnext" style="CURSOR: hand" style="CURSOR: hand" alt="下一页"  > 
                                        <img src="/static/imghwm/default1.png"  data-src="Images/btn_last.gif"  class="lazy"  id="btnlast" style="CURSOR: 
hand" style="CURSOR: hand" alt="尾页"  > 
                                    </td> 
                                </tr> 
                            </table> 
                        </td> 
                    </tr> 
                </table> 
            </div> 
        </form> 
    </body> 
</HTML>

Common.js

Common.js: 
//时间格式化 

function getDateByFormat(oldDate){ 
                var Dy = oldDate.getFullYear(); 
                var Dm = 
oldDate.getMonth()+1; 
                var Dd = oldDate.getDate(); 
                if(Dm<10){ 
                    Dm = "0" + Dm; 
                } 
                if(Dd<10){ 
                    Dd = "0" + Dd; 
                } 
                var newDate = Dy+&#39;-&#39;+Dm+&#39;-&#39;+Dd; 

                    return newDate; 
                } 
//日期-时间格式化 
function getDateTimeByFormat(oldDate){ 
                var Dy = 
oldDate.getFullYear(); 
                var Dm = oldDate.getMonth()+1; 
                var Dd = oldDate.getDate(); 
                var Dh = 
oldDate.getHours(); 
                var Dmi = oldDate.getMinutes();   
                var Ds    = oldDate.getSeconds();    
                if(Dm<10) 
                    Dm = "0" + Dm; 
                if(Dd<10) 
                    Dd = "0" + Dd; 

                if(Dh<10) 
                 Dh = "0" + Dh; 
                if(Dmi<10) 
                    Dmi = "0" + Dmi; 
                if(Ds<10) 
                    Ds = "0" + Ds; 

                var newDate = Dy+&#39;-&#39;+Dm+&#39;-&#39;+Dd+&#39; &#39;+Dh+&#39;:&#39;+Dmi+&#39;:&#39;+Ds; 
                    return newDate; 
                } 

//只能输入数字 
function txtnumber() 
            { 
                if 
((event.keyCode >57) || (event.keyCode <48)) 
                    return false;else return true; 
            } 

        //只能输入数字和字母 

    function txtnumchar() 
            { 
//65- 90 97-122 
                var kcode = event.keyCode; 
                if (kcode >= 48 && kcode <= 57) 
                    return true; 
                else if(kcode >= 65 
&& kcode <= 90) 
                    return true; 
                else if (kcode >= 97 && kcode <= 122) 
                    return true; 
                else 
                    return false; 
            }

getCommonTable.js 

getCommonTable.js 
//获取table头 
         function 
getTableHeadByWidth(widthSize,ids){ 
         var Tableone = "<table 
id=&#39;tab"+ids+"&#39; border=&#39;0&#39; cellspacing=&#39;0&#39; cellpadding=&#39;0&#39; "; 
         var 
Tabletwo = ">"; 
         if (widthSize == "") 
         return 
Tableone + Tabletwo; 
         else 
         return 
Tableone+"width="+widthSize+Tabletwo; 

        } 

         
//获取第一个tr td 传一个宽度值 
        function 
getTrAndTdFirstByCWidth(classname,widthSize){ 
         var tdone = " <tr 
"; 
         var tdtwo = "><td style="BORDER-BOTTOM: 1px solid;" 
style="BORDER-BOTTOM: 1px solid;" align=&#39;center&#39; "; 
         var tdthr = " 
> "; 
         if (classname =="") 
         tdone += tdtwo; 
         else 
         tdone+=" class =&#39;"+classname+"&#39; "+tdtwo; 

         if (widthSize == "") 
         tdone += tdthr; 
         else 
         tdone += " width="+widthSize+tdthr; 

         return 
tdone; 
        } 

        //获取下一个TD,传一个宽度值 
        function 
getTdNextByWidth(widthSize){ 
         var tdone = " </td><td 
style=" BORDER-BOTTOM: 1px solid" style=" BORDER-BOTTOM: 1px solid" 
align=&#39;center&#39; "; 
         var tdtwo =">"; 
         if (widthSize 
=="") 
         return tdone+tdtwo; 
         else 
         return 
tdone+"width="+widthSize+tdtwo; 
        } 

        //获取最后一个td 
        function getTdLastByWidth(widthSize){ 
         var tdone = 
" </td><td style=" BORDER-BOTTOM: 1px solid" style=" BORDER-BOTTOM: 1px 
solid" align=&#39;center&#39; "; 
         var tdtwo =">"; 
         if 
(widthSize =="") 
         return tdone+tdtwo; 
         else 
         return tdone+"width="+widthSize+tdtwo; 
        } 
        //获取最后一个tr/td 
        function getTrAndTdLast(){ 
         return 
" </td></tr>"; 
        } 

         
        //获取table尾 
        function getTableLast(){ 
         return "</table>"; 
        } 

        //获取img 
        function 
getImgByParams(imgUrl,altstr,eventName,eventParams,imgid){ 
         var one 
= "<img src="/static/imghwm/default1.png"  data-src="Images/uuu.gif"  class="lazy"  border=&#39;0&#39;   style="max-width:90%" style="CURSOR: hand""; 
         if (imgUrl != "") 
         one += "src=&#39;"+imgUrl+"&#39;"; 
         if 
(altstr != "") 
         one += "alt=&#39;"+altstr+"&#39;"; 
         if(imgid != 
"") 
         one += "id=&#39;"+imgid+"&#39;"; 

         one += 
"onclick=&#39;"+eventName+"("+eventParams+");&#39;> "; 

         return one 
        } 

//--------排序--------------------------- 
            //通过字段的内容排序 
        SortByBtnidAndCellName=function(btnId,cellName,celltype){ 
            var way =    getOpType(btnId);//0为正。1为倒 
            var ds = 
userdata.value; 
            var sortarr= new Array(); 
            if 
((ds!= null) && (typeof(ds) == "object")){ 
             var len = 
ds.Rows.length; 
             if(celltype==&#39;S&#39; || celltype==&#39;N&#39;){ 
                        for(var j=0;j<len;j++){ 
                            sortarr[j] = 
ds.Rows[j][cellName];//.substr(0,1);//通过字符 
                            } 
                    }else if(celltype==&#39;D&#39;){ 
                        for(var i=0;i<len;i++){ 
                                    sortarr[i] = 
getDateByFormat(ds.Rows[i][cellName]);//通过日期 
                            } 
                    } 
                if(sortarr!=&#39;&#39;){ 
                    var indexarr = new Array(); 
                    indexarr = getSortArray(sortarr,celltype);//得到新的排序规则 
                    if(indexarr != &#39;&#39;){ 
                        setSortAginbyWay(indexarr,way); 
                    } 
                } 
            } 
        } 

        //获得排序 
        getOpType=function(btnid){//返回0正序,1为倒序 
            var imgName= $("#"+btnid).attr("src"); 
            var wz = 
imgName.indexOf(&#39;.gif&#39;); 
            var oldImg =imgName.substr(wz-9,9); 
            if(oldImg==&#39;sort_desc&#39;){//当前是倒序或未排序,需要正序sort_ascc 
                $("#"+btnid).attr("src","../Images/sort_ascc.gif"); 
                return 0; 
            }else{ 
                $("#"+btnid).attr("src","../Images/sort_desc.gif"); 
                return 1; 
            } 

        } 
        //按JS Sort排序 获得新的排序规则 
        getSortArray=function 
(sortdatearr,celltype){// 参数为array 
                var sortstr = &#39;&#39;; 
                for(var k=0;k<sortdatearr.length;k++){ 
                if(sortstr==&#39;&#39;) 
                        sortstr=sortdatearr[k]; 
                    else 
                        sortstr+=&#39;^%^&#39;+sortdatearr[k]; 
                } 
                var newsortdate =sortdatearr; 
                var len = 
sortdatearr.length; 

                    if(celltype ==&#39;S&#39; || celltype 
==&#39;D&#39;) 
                        newsortdate.sort();//字符排序 
                    else{ //数字排序 
                        for(var 
i=0;i<len;i++){ 
                            var tmp =0; 
                            for(var j=i+1;j<len;j++){ 
                                if(newsortdate[i]>newsortdate[j]){ 
                                    tmp = newsortdate[i]; 
                                    newsortdate[i] = newsortdate[j]; 
                                    newsortdate[j] =tmp; 
                                } 
                            } 
                        } 
                    } 

             var 
tmpsortdate =sortstr.split(&#39;^%^&#39;) 

             var resultarr = new 
Array(); 
             for(var i = 0;i<len;i++){ 
                    for(var j = 0;j<len;j++){ 
                     if(newsortdate[i]==tmpsortdate[j]){ 
                            resultarr[i] 
= j; 
                            tmpsortdate[j] =&#39;||||||||&#39;; 
                            break; 
                     } 
                    } 
             } 

             return 
resultarr; 
        }; 

//--------------------end------------------------------- 
//删除重复的手机号码 
SplitRepeatMobile=function(mobile){ 
    var mob=mobile; 
    for(var 
i=0;i<mob.length;i++){ 
        for(var j=i+1;j<mob.length;j++){ 
            if(mob[i]==mob[j]){ 
                mob.splice(j,1); 
            } 
        } 
    } 
    return mob; 
}
GroupText.js 

        var totalCount;//总页 
var userdata;//数据对象 
    $(document).ready(function(){             

             
            if(ecid !=""){ 
             firstSearch(ecid); 
            } 

            $("#ddlCsList").change(function(){ 
             ecid = $.trim($("#ddlCsList").val()); 
             firstSearch(ecid); 
            }); 

            $("#btnfirst").click(function(){ 
         firstSearch(ecid); 
            }); 

            $("#btnnext").click(function(){ 
             nextSearch(ecid); 
            }); 

            $("#btnpre").click(function(){ 
             preSearch(ecid); 
            }); 

            $("#btnlast").click(function(){ 
             lastSearch(ecid); 
            }); 

            $("#gotopg").click(function(){ 
             gotoSearch(ecid); 
            }); 

         

}); 
//绑定数据 
        function binddata(udata) 
        { 
         jpstr 
="";//这样的目的是清空,很有用的一步 

         var ds = udata.value; 

                    if ((ds!= null) && (typeof(ds) == "object")) 
                    { 
                     //alert( ds.Rows[0].ItemName 
) 
                     var c = ds.Rows.length; 
                     var 
newarr = getdataarr(udata); 
                     for(var k = 0; 
k<newarr.length;k++){ 

                             
                            var tmp = newarr[k]; 
                            jpstr +="<tr><td style=" BORDER-BOTTOM: 
1px solid" style=" BORDER-BOTTOM: 1px solid"><img src="/static/imghwm/default1.png"  data-src="Images/uuu.gif"  class="lazy"  id 
=&#39;"+ds.Rows[tmp].srId+"&#39; onclick=showOrHide("+ds.Rows[tmp].srId+") 
style="CURSOR: hand" style="CURSOR: hand"  ><B>"+ds.Rows[tmp].ItemName+"</b></td></tr><tr><td>" 
                            var jpstrA=""; 
                            for(var i=tmp; i<c; i++) 
                            { 

                             if(ds.Rows[tmp].ItemName == ds.Rows[i].ItemName ){ 
                                            jpstrA += 
getTrAndTdFirstByCWidth("dg_item","10%") + 
                                                            ""+ds.Rows[i].ItemName 
+ getTdNextByWidth("10%") + 
                                                            ""+ds.Rows[i].SendMod 
+ getTdNextByWidth("10%") + 
                                                            ""+ds.Rows[i].RecvMod 
+ getTdNextByWidth("12%") + 
                                                            ""+getDateByFormat(ds.Rows[i].SendDate) 
+ getTdNextByWidth("38%") + 
                                                            ""+ds.Rows[i].SendMsg 
+ getTdNextByWidth("10%") + 
                                                            ""+ds.Rows[i].JfValue 
+ getTdLastByWidth("10%") + 
                                                            ""+getTextByStatus(ds.Rows[i].SendStatus) 
+ 
                                                            "" + 
getTrAndTdLast(); 
                                        } 
                                }     

                                jpstr 
+=getTableHeadByWidth("100%",ds.Rows[tmp].srId) + jpstrA + getTableLast(); 

                                jpstr += "</td></tr>"; 

                        } 
                        jpstr ="<table 
width=100%>"+jpstr+"</table>"; 

                             

                                document.getElementById("divcontent").innerHTML 
= jpstr; 
                                //alert(jpstr); 

                } 
                else 
                { 
                    document.getElementById("divcontent").innerHTML = 
"";     
                } 

} 
showOrHide=function(ids){ 
            $("#tab"+ids).toggle(); 
            var imgName= 
$("#"+ids).attr("src"); 

                var wz = 
imgName.indexOf(&#39;.gif&#39;); 
                var oldImg =imgName.substr(wz-3,3); 

                if(oldImg==&#39;uuu&#39;)//选择 
                        $("#"+ids).attr("src","Images/eee.gif"); 
                else{ 
                    $("#"+ids).attr("src","Images/uuu.gif"); 

                    } 

} 
function getdataarr(udata){ 
var 
ds = udata.value; 
            var resultArr= new Array(); 
            var dsstr=&#39;&#39;; 
            for(var i=0; i<ds.Rows.length; 
i++){ 
                resultArr[i] = $.trim(ds.Rows[i].ItemName); 
                if(dsstr==&#39;&#39;) 
                 dsstr 
=$.trim(ds.Rows[i].ItemName); 
                 else 
                 dsstr+=&#39;^%^&#39;+$.trim(ds.Rows[i].ItemName) 
            } 

            splitStr(resultArr) 

            var newArr = new 
Array(); 
            var temparr=dsstr.split(&#39;^%^&#39;) 
            for(var 
k=0;k<resultArr.length;k++){ 
                for(var 
m=0;m<temparr.length;m++){ 
                    if(resultArr[k]==temparr[m]){ 
                        newArr[k]=m; 
                        break; 
                    } 
                } 
            } 

            return newArr; 
} 
splitStr= function(oldarr){ 
                var nArr=oldarr; 
                var isok=false; 
                for(var l=0;l<nArr.length;l++){ 
                    for(var j=l+1;j<nArr.length;j++){ 
                    if(nArr[l]==nArr[j]){ 
                        nArr.splice(j,1); 
                        isok=true; 
                        }     
                } 
            } 

            if(isok) 
                splitStr(nArr); 

} 
function 
getTextByStatus(status){ 
            if(status==0){ 
             return 
"<font color=&#39;blue&#39;>启用</font>"; 
}else{ 
             return 
"<font color=&#39;red&#39;><B>禁用</B></font>"; 
} 
} 
function getImgByStatus(status){ 
if(status==0){ 
return 
"../Images/gz2.gif"; 
}else{ 
return "../Images/gz1.gif"; 
} 
} 
function getTxtByStatus(status){ 
if(status==0){ 
return "我要禁用"; 
}else{ 
return "我要启用"; 
} 
} 
//第一页 
        function 
firstSearch(ecid) 
        { 
         if (ecid != ""){ 
                 totalCount = Interactive.GetCmdSMSlogCount("1=1").value; 
                    userdata = 
Interactive.PageingOpenCmdSMSLog(1,pageSize);//Interactive.getInteractiveSMSByEcid(ecid,pageSize,1,totalCount); 

                    binddata(userdata); 

                    $("#recordcount").html(totalCount.toString());//curpageindex 
                    $("#curpageindex").html(totalCount==0?&#39;0&#39;:1); 
                    if (totalCount % pageSize ==0) 
                    { 
                     $("#pgcount").html((totalCount / pageSize).toString()); 
                    }else{ 
                     $("#pgcount").html(parseInt(totalCount / pageSize)+1); 
                    } 

                } 
        } 
    //下一页 
        function 
nextSearch(ecid){ 
         if (ecid != ""){ 
         var curpg 
=$("#curpageindex").html();//得到当前页 
         var pgCount = 
$("#pgcount").html();//得到总的页数 
         if (curpg < pgCount){ 
                        totalCount = 
Interactive.GetCmdSMSlogCount(&#39;1=1&#39;).value; 
                     userdata = 
Interactive.PageingOpenCmdSMSLog(parseInt(curpg)+1,pageSize); 

                        binddata(userdata); 
                        $("#recordcount").html(totalCount);//curpageindex 
                        $("#curpageindex").html(parseInt(curpg)+1); 
                        if (totalCount % pageSize ==0) 
                        { 
                        $("#pgcount").html(totalCount / pageSize); 
                        }else{ 
                            $("#pgcount").html(parseInt(totalCount / 
pageSize)+1); 
                        } 
                    }else{ 
                     alert("当前已经是尾页了!"); 
                    } 
                } 
        } 
    //上一页 
        function 
preSearch(ecid){ 
         if (ecid != ""){ 
         var curpg 
=$("#curpageindex").html();//得到当前页 
         var pgCount = 
$("#pgcount").html();//得到总的页数 
         if (curpg > 1 ){ 
                        totalCount = 
Interactive.GetCmdSMSlogCount(&#39;1=1&#39;).value; 
                     userdata = 
Interactive.PageingOpenCmdSMSLog(parseInt(curpg)-1,pageSize); 
                        binddata(userdata); 
                        $("#recordcount").html(totalCount);//curpageindex 
                        $("#curpageindex").html(parseInt(curpg)-1); 
                        if (totalCount % pageSize ==0) 
                        { 
                        $("#pgcount").html(totalCount / pageSize); 
                        }else{ 
                            $("#pgcount").html(parseInt(totalCount / 
pageSize)+1); 
                        } 
                    }else{ 
                         alert("当前已经是首页了!"); 
                    } 
                } 
        } 
        //尾页 
        function 
lastSearch(ecid){ 
         if (ecid != ""){ 
         var curpg 
=$("#curpageindex").html();//得到当前页 
         var pgCount = 
$("#pgcount").html();//得到总的页数 
         if (curpg < pgCount ){ 
                        totalCount = 
Interactive.GetCmdSMSlogCount(&#39;1=1&#39;).value; 
                     userdata = 
Interactive.PageingOpenCmdSMSLog(pgCount,pageSize); 
                        binddata(userdata); 
                        $("#recordcount").html(totalCount);//curpageindex 
                        $("#curpageindex").html(pgCount); 
                        if (totalCount % pageSize ==0) 
                        { 
                        $("#pgcount").html(totalCount / pageSize); 
                        }else{ 
                            $("#pgcount").html(parseInt(totalCount / 
pageSize)+1); 
                        } 
                    } 
                } 

        } 

        //跳转指定页 
        function gotoSearch(ecid){ 
         if (ecid != ""){ 
         var curpg =$("#curpageindex").html();//得到当前页 
         var 
pgCount = $("#pgcount").html();//得到总的页数 
         var pggoto 
=$("#gototxt").val(); 
         var reg = /[^\d]/g; 
                    if (($.trim(pggoto) != "") && 
!(reg.test(pggoto))){ 
                        if ((parseInt(curpg) != 
parseInt(pggoto)) && (pggoto <= pgCount)){ 
                            totalCount = 
Interactive.GetCmdSMSlogCount(&#39;1=1&#39;).value; 
                            userdata = 
Interactive.PageingOpenCmdSMSLog(pggoto,pageSize); 
                            binddata(userdata); 
                            $("#recordcount").html(totalCount);//curpageindex 
                            $("#curpageindex").html(pggoto); 
                            if (totalCount % pageSize ==0) 
                            { 
                            $("#pgcount").html(totalCount / pageSize); 
                            }else{ 
                                $("#pgcount").html(parseInt(totalCount / 
pageSize)+1); 
                            } 
                        } 
                    }else{ 
                        alert("请输入正确的数字!"); 
                    } 

                } 

        } 

        //刷新 
        function Refresh(ecid){ 
         if (ecid 
!= ""){ 
         var curpg =$("#curpageindex").html();//得到当前页 

                    totalCount = 
Interactive.GetCmdSMSlogCount(&#39;1=1&#39;).value; 
                    userdata = 
Interactive.PageingOpenCmdSMSLog(curpg); 
                    binddata(userdata); 
                    $("#recordcount").html(totalCount);//curpageindex 
                    $("#curpageindex").html(curpg); 
                    if (totalCount % pageSize ==0) 
                    { 
                    $("#pgcount").html(totalCount / pageSize); 
                    }else{ 
                        $("#pgcount").html(parseInt(totalCount / 
pageSize)+1); 
                    } 

                     
                } 

        }
GroupText.aspx.cs: 
private void Page_Load(object sender, System.EventArgs e) 
{ 
// 在此处放置用户代码以初始化页面 
Ajax.Utility.RegisterTypeForAjax(typeof(DataAccess.Interactive)); 
}
Interactive.cs: 
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)] 
        public DataTable PageingOpenCmdSMSLog(int pgindex,int pageSize) 
        { 
            int pageIndex=pgindex; 
            DataTable 
dt = new DataTable (); 
            JSONHelper json = new JSONHelper(); 
            int count = GetCmdSMSlogCount("1=1"); 
            dt = 
GetDataByPager2000("SendAndRecvData S left join InteractiveSMS I on 
(S.ItemId=I.Id AND S.ECID=I.ECID)","srId","1=1",pageSize,pageIndex,"srId",1, 
                "S.srId,I.ItemName,S.SendMod,S.RecvMod,S.SendDate,S.SendMsg,S.JfValue,S.SendStatus",count); 
            return dt; 
        } 

        [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)] 
        public int GetCmdSMSlogCount(string where) 
        { 
            try 
            { 
                int count = 
ReturnSQL("select count(*) from SendAndRecvData S left join InteractCommand I 
on(S.ItemId=I.Id AND S.ECID=I.ECID) where "+where); 
                return 
count; 
            } 
            catch (Exception) 
            { 

                throw; 
            } 
        } 
        /// 
<summary> 
        /// 分页获取数据列表 适用于SQL2000 
        /// 
</summary> 
        /// <param name="tablename">表名</param> 
        /// <param name="key">主键</param> 
        /// 
<param name="where">查询条件</param> 
        /// <param 
name="pagesize">每页记录数</param> 
        /// <param 
name="pageindex">页索引</param> 
        /// <param 
name="orderfield">排序字段</param> 
        /// <param 
name="ordertype">排序方式 1=ASC 0=DESC</param> 
        /// <param 
name="fieldlist">查找的字段</param> 
        /// <param 
name="recordcount">总记录数</param> 
        /// 
<returns></returns> 
        public static DataTable 
GetDataByPager2000(string tablename, string key, string where, int pagesize, int 
pageindex, string orderfield, int ordertype, string fieldlist, int recordcount) 
        { 
            string cmd = "ProcCustomPage"; 
            SqlParameter[] para = new SqlParameter[9]; 
            para[0] = new SqlParameter("@Table_Name", tablename); 
            para[1] = new SqlParameter("@Sign_Record", key); 
            para[2] = new SqlParameter("@Filter_Condition", where); 
            para[3] = new SqlParameter("@Page_Size", pagesize); 
            para[4] = new SqlParameter("@Page_Index", pageindex); 
            para[5] = new SqlParameter("@TaxisField", orderfield); 
            para[6] = new SqlParameter("@Taxis_Sign", ordertype); 
            para[7] = new SqlParameter("@Find_RecordList", fieldlist); 
            para[8] = new SqlParameter("@Record_Count", recordcount); 

            return ExecuteDataSet(CommandType.StoredProcedure, cmd, 
para).Tables[0]; 

        } 
        public static DataSet 
ExecuteDataSet(CommandType cmdType, string cmdText, params SqlParameter[] para) 
        { 
            try 
            { 
                using 
(SqlConnection con = new SqlConnection(CONN_STRING)) 
                { 
                    SqlDataAdapter adapter = new SqlDataAdapter(); 

                    using (SqlCommand cmd = new SqlCommand()) 
                    { 
                        DataSet ds = new 
DataSet(); 
                        PrepareCommand(con, cmd, cmdType, 
cmdText, para); 
                        adapter.SelectCommand = cmd; 
                        adapter.Fill(ds); 

                        return ds; 
                    } 
                } 
            } 
            catch(Exception ex) 
            { 
                string d=ex.ToString(); 
                return null; 
            } 
        } 
        /// 
<summary> 
        /// 建立SqlCommand 
        /// </summary> 
        /// <param name="con">SqlConnection 对象</param> 
        /// <param name="cmd">要建立的Command</param> 
        /// <param name="cmdType">CommandType</param> 
        /// <param name="cmdText">执行的SQL语句</param> 
        /// <param name="cmdParms">参数</param> 
        private static void PrepareCommand(SqlConnection con, SqlCommand 
cmd, CommandType cmdType, string cmdText, SqlParameter[] cmdParms) 
        { 
            if (con.State != ConnectionState.Open) 
                con.Open(); 

            cmd.Connection = con; 
            cmd.CommandType = cmdType; 
            cmd.CommandText = 
cmdText; 

            if (cmdParms != null) 
                foreach 
(SqlParameter para in cmdParms) 
                    cmd.Parameters.Add(para); 
        }
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Understanding the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)How to Build a Multi-Tenant SaaS Application with Next.js (Frontend Integration)Apr 11, 2025 am 08:22 AM

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools