类似QQ相册的效果

 .aspx页面代码:
<table width="650" border="0" cellspacing="0" cellpadding="0" style="font-size: 12px;">
                                <tr>
                                    <td height="30" align="left">
                                            <asp:Label ID="LBTitle" runat="server" Text=""></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="center" height="30" style="border-bottom: #a1a1a1 1px solid;">
                                        <webdiyer:AspNetPager ID="AspNetPager2" runat="server" PageSize="1" FirstPageText="第一张"
                                            ForeColor="#404040" LastPageText="最后一张" NextPageText="下一张" NumericButt
                                            PageIndexBoxType="TextBox" Font-Size="12px" PrevPageText="上一张" ReverseUrlPageIndex="True"
                                            ShowFirstLast="False" >
                                        </webdiyer:AspNetPager>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <br />
                                        <asp:Repeater ID="RPTPic" runat="server">
                                            <ItemTemplate>
                                                <div style=" width: 640px;">
                                                    <img src="<%# Eval("pic1") %>" id="achome" style="border: #a1a1a1 5px solid;" />
                                                </div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </td>
                                </tr>
                            </table>
.aspx.cs代码:
/// <summary>
    /// 作品图片
    /// </summary>
    private void GetPic()
    {
        CMS.BLL.PicManage pm = new CMS.BLL.PicManage();
        pm.SortField = "id asc";
        System.Collections.ArrayList al = new ArrayList();
        if (!IsPostBack)
        {
            al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]), this.Getpicnum(), this.AspNetPager2.PageSize);
        }
        else
        {
            al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]), this.AspNetPager2.StartRecordIndex - 1, this.AspNetPager2.PageSize);
        }
        this.RPTPic.DataSource = al;
        this.RPTPic.DataBind();
        al.Clear();
        pm.Dispose();
    }
    private void Pageing2()
    {
        CMS.BLL.PicManage pm = new CMS.BLL.PicManage();
        pm.SortField = "id asc";
        System.Collections.ArrayList al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]));
        this.AspNetPager2.RecordCount = al.Count;
    }
    protected void AspNetPager2_PageChanged(object sender, EventArgs e)
    {
        this.GetPic();
        this.Paging();
        this.BindDLcomment();
    }
private int Getinfoid()
    {
        CMS.BLL.PicManage pm = new CMS.BLL.PicManage();
        pm.SortField = "id asc";
        System.Collections.ArrayList al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]), this.AspNetPager2.StartRecordIndex - 1, this.AspNetPager2.PageSize);
        pm.Dispose();
        if (al.Count > 0)
        {
            CMS.Model.CMS_PicT pt = (CMS.Model.CMS_PicT)al[0];
            return pt.id;
        }
        return 0;
    }
获取当前图片为第几张
    private int Getpicnum()
    {
        if (Request["id"] != null && Request["id"] != "")
        {
            CMS.BLL.PicManage pm = new CMS.BLL.PicManage();
            pm.SortField = "id asc";
            System.Collections.ArrayList al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]));
            pm.Dispose();
            if (al.Count > 0)
            {
                for (int i = 0; i < al.Count; i++)
                {
                    if (((CMS.Model.CMS_PicT)al).id ==Convert.ToInt32(Request["id"]))
                    {
                        return i;
                    }
                }
            }

        }
        return 0;
    }
    private string Getpicname()
    {
        CMS.BLL.PicManage pm = new CMS.BLL.PicManage();
        pm.SortField = "id asc";
        System.Collections.ArrayList al = pm.Get("kindID=" + Convert.ToInt32(Request["phoneid"]), this.AspNetPager2.StartRecordIndex - 1, this.AspNetPager2.PageSize);
        pm.Dispose();
        if (al.Count > 0)
        {
            CMS.Model.CMS_PicT pt = (CMS.Model.CMS_PicT)al[0];
            return pt.name;
        }
        return "";
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值