zoukankan      html  css  js  c++  java
  • 封装一下webform的公用方法:对于软件我把这些全封装在pagebase里面,这样所有的页面只调用一句 Init()即可,其他的全在页面上配置

      /// <summary>
            /// 绑定新闻列表,带分页与查询
            /// </summary>
            /// <param name="a"></param>
            /// <param name="AspNetPager1"></param>
            /// <param name="filter"></param>
            protected void BindList(Repeater a, AspNetPager AspNetPager1, Expression<Func< bool>> filter) {
                ClassNo = Request["ClassNo"];
                var new_list = new List<JY_Newss>();
                try {
                    new_list = Common.GetNewsListByCNo(ClassNo).OrderByDescending(u => u.CreateTime).ToList();
                    AspNetPager1.RecordCount = new_list.Count();
                    if (AspNetPager1.StartRecordIndex == 1) {
                        new_list = new_list.Take(15).ToList();
                    } else {
                        new_list = new_list.Skip(AspNetPager1.StartRecordIndex - 1).Take(15).ToList();
                    }
                    AspNetPager1.PageChanged += (c, d) => {
                        BindList(a, AspNetPager1, null);
                    };
                    a.DataSource = new_list;
                    a.DataBind();
     
                } catch { }
            }
  • 相关阅读:
    std::exception标准和各平台实现的不同
    学习Linux必备的硬件基础一网打尽
    Git安装及SSH Key管理之Windows篇
    简要介绍一下Dos/Windows格式文件和Unix/Linux格式文件(剪不断理还乱的 和 )
    C/C++中的序列点
    STL容器之vector 的下标越界是否报错
    二维数组与指针的联系与区别
    C/C++ strlen函数为什么不能传入空指针NULL?
    棋盘游戏
    Knight Moves
  • 原文地址:https://www.cnblogs.com/hualiu0/p/4532807.html
Copyright © 2011-2022 走看看