1 using System;
2 using System.Web;
3 using System.Web.UI;
4 using System.Web.UI.WebControls;
5
6 using Sigil.Common;
7 using SigilSoft.Data.SqlClient;
8 using System.Data;
9
10 namespace Sigil.OutCall
11 {
12 public partial class list : System.Web.UI.Page
13 {
14 private Gladiator g = new Gladiator();
15
16 protected void Page_Load(object sender, EventArgs e)
17 {
18 if (!IsPostBack)
19 {
20 bindlist();
21 }
22
23 }
24 //绑定产品
25 private void bindlist()
26 {
27 string sql = @" select p.productid,p.productname,filepath,p.url from product p INNER JOIN attachments a on p.productid = a.itemid where productstate=4 group by p.productid order by p.productid";
28
29 MainRepeater.DataSource = g.GetDataTable(sql, SqlStringFrom.Program);
30 MainRepeater.DataBind();
31 }
32 //绑定图片列表
33 protected void MainRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
34 {
35 //定位里面的Repeater
36 if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
37 {
38
39 Repeater imgRepeater = (Repeater)e.Item.FindControl("ImgRepeater");
40 //获取外面Reperter的值
41 DataRowView drv = (DataRowView)e.Item.DataItem;
42 int productid = Convert.ToInt32(drv["productid"]);
43 string sql = @"select p.productid,p.productname,filepath,p.url from product p , attachments a where p.productid = a.itemid and productstate=4 and p.productid=" + productid + "";
44 imgRepeater.DataSource = g.GetDataTable(sql, SqlStringFrom.Program);
45 imgRepeater.DataBind();
46 }
47 }
48 }
49 }