图片列表页显示

实现效果,通过设置css中div宽度来改变列数。

list.aspx.cs

if (!IsPostBack)
        {
            Dqt.Reporter.BLL.user userbll = new Dqt.Reporter.BLL.user();
            int pageSize = 32;
            int pageindex = 1;
            if (!string.IsNullOrEmpty(Request.QueryString["page"]))
            pageindex = int.Parse(Request.QueryString["page"]);
            pageindex = pageindex < 1 ? 1 : pageindex;
            int totle = userbll.GetRecordCount("");
            pager1.RecordCount = totle;
            if (totle > pageSize)
            pager1.Visible = true;
            pager1.PageUrl = "/gaojian/list.aspx";
            pager1.PageSize = pageSize;
            pager1.DestPage = pageindex;
            List<Dqt.Reporter.Model.user> usermodellist = userbll.GetModelList("", pageindex, pageSize, "UserJiFen desc");
            rptlist.DataSource = usermodellist;
            rptlist.DataBind();
        }

 public List<Dqt.Reporter.Model.user> GetModelList(string strWhere, int pageNo, int pageSize, string orderBy)
        {
            DataSet ds = dal.GetList(strWhere, pageNo, pageSize, orderBy);
            return DataTableToList(ds.Tables[0]);
        }

public DataSet GetList(string strWhere, int pageNo, int pageSize, string orderBy)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select UserId,UserName,UserPassword,Email,Tel,UserSex,TureName,UserAge,UserXingQu,UserTouXiang,LastLoginIp,UserJiFen,UserZhuCeTime,LastLoginTime,Type,SelfIntroduction,Tuijian,ClassNum,SchoolId ");
            strSql.Append(" FROM user ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append("  Order By  " + orderBy + " ");
            strSql.Append(" limit " + ((pageNo - 1) * pageSize) + "," + pageSize + " ");
            return DbHelperMySQL.Query(strSql.ToString());
        }

  list.aspx

  <div class="alllist">
        <ul>
            <asp:Repeater ID="rptlist" runat="server">
                <ItemTemplate>
                    <li>
                    <a href="/usercenter/wodegaojian.aspx?uid=<%#Eval("UserId") %>">
                        <img src="<%#Eval("UserTouXiang") %>" title="<%#Eval("UserName") %>" οnerrοr="this.src='/img/pinglun_img.gif';" />
                     </a> 
                     <span><a href="/usercenter/wodegaojian.aspx?uid=<%#Eval("UserId") %>" title="<%#Eval("UserName") %>">
                            <%#Dqt.Reporter.Common.MFunction.Text_Substring( Eval("UserName").ToString(),10,"...") %></a>
                       </span>
                        <br />
                     <p>  <%#Dqt.Reporter.Common.MFunction.GetClass(Eval("ClassNum").ToString()) %></p>
                    </li>
                </ItemTemplate>
            </asp:Repeater>
        </ul>
    </div>
    <div class="pageses">
        <uc4:pager ID="pager1" runat="server" Visible="false" />
    </div>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值