异步分页技术

异步分页技术

打造最便捷的异步分页技术

 

一、建一个项目(以WebForm为例)

配置文件配置(注意您自己的路径)

二、在页面上生成分页布局代码

1)后端代码

复制代码
        public string Pager{

            get;

            set;

        }

        private void Page_Load(object sender, EventArgs e)

        {

            

            using (var db=Db.CreateDefaultDb()) {

                var mqlJoin=ScoreSet.SelectAll()

                    .InnerJoin(StudentSet.Select(StudentSet.Name))

                    .InnerJoin(ClassSet.Select(ClassSet.ID.AS("ClassID"),ClassSet.ClassName))

                    .ON(ScoreSet.StudentID.Equal(StudentSet.ID)

                        .And(StudentSet.ClassID.Equal(ClassSet.ID) )

                       );

                this.Pager=Moon.Orm.Util.Pager.GetWebPager(db,"SmallPage.aspx","content",mqlJoin,3,null);

            }

        }
复制代码

 

2)前端代码

复制代码
<%@ Page

    Language           = "C#"

    AutoEventWireup    = "false"

    Inherits           = "Moon.Pager.Default"

    ValidateRequest    = "false"

    EnableSessionState = "false"

%>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <title>Moon.Pager</title>



         <script src="http://common.cnblogs.com/script/jquery.js" type="text/javascript"></script>



    </head>

    <body>

        <div id="content"></div>

        <%=this.Pager%>

    </body>

</html>
复制代码

 

三、加一个异步请求数据的小页面

1)后端代码

复制代码
public  DictionaryList List;

        private void Page_Load(object sender, System.EventArgs e)

        {

            using (var db=Db.CreateDefaultDb()) {

                var mqlJoin=ScoreSet.SelectAll()

                    .InnerJoin(StudentSet.Select(StudentSet.Name))

                    .InnerJoin(ClassSet.Select(ClassSet.ID.AS("ClassID"),ClassSet.ClassName))

                    .ON(ScoreSet.StudentID.Equal(StudentSet.ID)

                        .And(StudentSet.ClassID.Equal(ClassSet.ID) )

                       );

                this.List=Moon.Orm.Util.Pager.GetOneWebPagesData(db,mqlJoin,null);

            }

        }
复制代码

 

2)前端代码(SmallPage.aspx:对应前面的代码)

复制代码
<%@ Page

    Language           = "C#"

    AutoEventWireup    = "false"

    Inherits           = "Moon.Pager.SmallPage"

    ValidateRequest    = "false"

     

%>

<%

foreach(var a in this.List){%>

<p><%=a["ID"]%>&nbsp;<%=a["Name"]%></p>

<%}%>
复制代码

 

四、效果图

五、下载地址

http://pan.baidu.com/share/link?shareid=915781506&uk=353229276

六、在线体验(其实你们来在线体验页面,我是知道的,来了就留个言吧)

http://123171.dowei8.com/

 

你可能感兴趣的:(分页技术)