Leon's Blog

Programmer

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
<asp:DataList id="DataList1" runat="server" DataKeyField="TypeID" HorizontalAlign="Center"> <ItemTemplate> <TABLE cellSpacing="4" cellPadding="0" width="99%" align="center" border="0"> <TR> <TD width="17%" rowSpan="2"><IMG height="87" src="Images/test1.gif" width="115"></TD> <TD width="83%"> <TABLE cellSpacing="0" cellPadding="0" width="617" border="0"> <TR> <TD width="29"><IMG height="27" src="Images/sort_top.gif" width="29"></TD> <TD width="568" background="Images/sort_mid.gif"> <!--<%# "<a href=\"Sort.aspx?TypeID="http://10.187.202.3/+DataBinder.Eval(Container.DataItem,"TypeID")+"\">"%>--> <%# DataBinder.Eval(Container.DataItem,"TypeName")%> </a> </TD> <TD width="20"><IMG height="27" src="Images/sort_right.gif" width="19"></TD> </TR> </TABLE> </TD> </TR> <TR> <TD> <asp:DataList id="Layer" runat="server" RepeatColumns="4" Width="90%" HorizontalAlign="Center"> <ItemTemplate> <%# "<a href=\"Sort.aspx?TypeID="+DataBinder.Eval(Container.DataItem,"TypeID")+"\">"%> <%# DataBinder.Eval(Container.DataItem,"TypeName")%> </a> </ItemTemplate> </asp:DataList> </TD> </TR> </TABLE> </ItemTemplate> </asp:DataList> <TABLE height="22" cellSpacing="0" cellPadding="0" width="762" align="center" border="0" id="TABLE1" runat="server"> <TR> <TD background="Images/SortAll.gif" height="18">&nbsp;&nbsp; &nbsp; <asp:Label id="Label2" runat="server">Label</asp:Label></TD> </TR> </TABLE> <asp:DataList id="DataList2" runat="server" RepeatColumns="6" Width="100%" HorizontalAlign="Center"> <ItemTemplate> <TABLE cellSpacing="0" cellPadding="0" border="0"> <TR> <TD><IMG height="12" src="Images/Photo_left_top.gif" width="13"></TD> <TD background="Images/Photo_left_top_mid.gif"><IMG height="12" src="Images/Photo_left_top_mid.gif" width="5"></TD> <TD><IMG height="12" src="Images/Photo_right_top.gif" width="10"></TD> </TR> <TR> <TD background="Images/Photo_left_mid.gif" rowSpan="4"><IMG height="10" src="Images/Photo_left_mid.gif" width="13"></TD> <TD><%# Image(DataBinder.Eval(Container.DataItem,"SmallURL").ToString(),DataBinder.Eval(Container.DataItem,"FoldID").ToString(),DataBinder.Eval(Container.DataItem,"UserName").ToString())%></TD> <TD background="Images/Photo_right_mid.gif" rowSpan="4"><IMG height="5" src="Images/Photo_right_mid.gif" width="10"></TD> </TR> <TR> <TD><IMG height="3" alt="" src="" width="1" name=""></TD> </TR> <TR> <TD background="Images/popline.gif"><IMG height="1" alt="" src="" width="1" name=""></TD> </TR> <TR> <TD> <%# DataBinder.Eval(Container.DataItem,"FoldName")%> </TD> </TR> <TR> <TD><IMG height="9" src="Images/Photo_left_down.gif" width="13"></TD> <TD background="Images/Photo_down_mid.gif"><IMG height="9" src="Images/Photo_down_mid.gif" width="5"></TD> <TD><IMG height="9" src="Images/Photo_right_down.gif" width="10"></TD> </TR> </TABLE> </ItemTemplate> </asp:DataList> <TABLE height="25" cellSpacing="0" cellPadding="0" width="762" align="center" border="0" id="TABLE2" runat="server"> <TR> <TD background="Images/pageline.gif">&nbsp; <asp:Label id="Label1" runat="server">Label</asp:Label></TD> </TR> </TABLE>

<!---------上面页面代码----->

程序代码

namespace Hzren.Photo { using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Sqlconnection; using Component; /// <summary> /// AllSortList 的摘要说明。 /// </summary> public class AllSortList : System.Web.UI.UserControl { protected System.Web.UI.WebControls.DataList Layer; protected System.Web.UI.WebControls.DataList DataList1; protected System.Web.UI.WebControls.Label Label1; protected System.Web.UI.WebControls.DataList DataList2; protected System.Web.UI.HtmlControls.HtmlTable TABLE1; protected System.Web.UI.HtmlControls.HtmlTable TABLE2; Connection conn=new Connection(); protected System.Web.UI.WebControls.Label Label2; SaftCom Saft=new SaftCom(); private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 DataSet ds=conn.Datalist("Select * from PhotoType where ParentID=0","Table"); DataList1.DataSource=ds; DataList1.DataBind(); if(Saft.isNumber(Request.QueryString["TypeID"])) { int pagesize=24; int PageNum=0; int BeginNum=0; if(System.Web.HttpContext.Current.Request.QueryString["Page"]!=null) { PageNum=Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["Page"]); } else { PageNum=0; } if(PageNum==0) { BeginNum=1; } DataList1.Visible=false; DataSet ds1=conn.Datalist("Select SmallURL ,PhotoFold.FoldName,PhotoURL.FoldID,UserName from PhotoURL,PhotoFOLD,PhotoType,UserInfo where UserInfo.ID=PhotoFold.UserID and PhotoType.TypeID=PhotoFold.SmallID and PhotoFold.FoldID=PhotoURL.FoldID and IsTop=1 and PhotoFold.IsPub=1 and PhotoType.TypeID='"+Saft.outStr(Request.QueryString["TypeID"])+"'","Table",(BeginNum-1)*pagesize,pagesize); DataList2.DataSource=ds1; DataList2.DataBind(); Label1.Text=conn.Page("Select count(*) as count from PhotoURL,PhotoFOLD,PhotoType,UserInfo where UserInfo.ID=PhotoFold.UserID and PhotoType.TypeID=PhotoFold.SmallID and PhotoFold.FoldID=PhotoURL.FoldID and IsTop=1 and PhotoFold.IsPub=1 and PhotoType.TypeID='"+Saft.outStr(Request.QueryString["TypeID"])+"'","&TypeID="+Request.QueryString["TypeID"]+"",24); Label2.Text=conn.getRecordData("Select TypeName from PhotoType where TypeID="+Request.QueryString["TypeID"],"TypeName"); } else { DataList2.Visible=false; TABLE1.Visible=false; TABLE2.Visible=false; } } public string Image(string Image,string FoldID,string UserName) { return "<a href=\"Album.aspx?FoldID="+FoldID+"\"><img src=UserPhoto/"+UserName+"/"+Image+" border=0></a>"; } public void LayerBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e) { System.Web.UI.WebControls.DataList InLayer; InLayer=(DataList)e.Item.FindControl("Layer"); DataSet ds=conn.Datalist("Select * from PhotoType where ParentID="+this.DataList1.DataKeys[e.Item.ItemIndex],"Table"); InLayer.DataSource=ds; InLayer.DataBind(); // 在此处放置用户代码以初始化页面 } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器 /// 修改此方法的内容。 /// </summary> private void InitializeComponent() { this.DataList1.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.LayerBound); this.Load += new System.EventHandler(this.Page_Load); } #endregion } }
posted on 2007-09-03 12:00  疯蜂  阅读(133)  评论(0编辑  收藏  举报