.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 "";
}
<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 "";
}