Default.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;
- using System.Xml;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Bind();
- Tree();
- }
- if (Request.QueryString["id"] != null)
- {
- string sql = "select top 4 * from books where CategoryId=" + Convert.ToInt32(Request.QueryString["id"]) + "";
- this.Repeater1.DataSource = DBHelp.Select("select top 4 * from books where CategoryId=" + Convert.ToInt32(Request.QueryString["id"]) + "");
- this.Repeater1.DataBind();
- }
- }
- public void Bind()
- {
- this.Repeater1.DataSource = DBHelp.Select("select top 4 * from books");
- this.Repeater1.DataBind();
- }
- 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);
- }
- }
- }