zhuye.aspx.cs
资源名称:SunShine.rar [点击查看]
上传用户:tjxpgg
上传日期:2017-05-14
资源大小:2244k
文件大小:1k
源码类别:
SilverLight
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- public partial class zhuye : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- Tree();
- BindRepeater1();
- BindDataList();
- bind2();
- }
- public void Tree()
- {
- DataTable dt = DBHelp.Select("select * from Categories");
- foreach (DataRow dr in dt.Rows)
- {
- TreeNode tn = new TreeNode();
- tn.Text = dr["name"].ToString();
- tn.Value = dr["id"].ToString();
- tn.NavigateUrl = "Default.aspx?id=" + tn.Value;
- this.TreeView1.Nodes.Add(tn);
- }
- }
- public void BindRepeater1()
- {
- this.Repeater1.DataSource = DBHelp.Select("select * from books where id='4942'");
- this.Repeater1.DataBind();
- }
- public void BindDataList()
- {
- this.DataList1.DataSource = DBHelp.Select("select top 4 * from books");
- this.DataList1.DataBind();
- }
- public void bind2()
- {
- this.Repeater2.DataSource = DBHelp.Select("select top 1 * from books order by clicks desc");
- this.Repeater2.DataBind();
- }
- }