Asp.net源码专业站
首页->尚未分类->无限级树形(三层开发)源码>>WebUI/ddl.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:无限级树形(三层开发)源码
当前文件:文件类型 ClassTree/WebUI/ddl.aspx.cs[1K,2009-6-12 11:36:01]打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.Configuration; 4using System.Data; 5using System.Linq; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.HtmlControls; 10using System.Web.UI.WebControls; 11using System.Web.UI.WebControls.WebParts; 12using System.Xml.Linq; 13using System.Data.SqlClient; 14//该源码下载自www.51aspx.com(51aspx.com) 15 16public partial class ddl : System.Web.UI.Page 17{ 18 protected void Page_Load(object sender, EventArgs e) 19 { 20 if (!Page.IsPostBack) 21 { 22 this.GetArticleCategory("0"); 23 } 24 25 } 26 string toadd = ""; 27 private void GetArticleCategory(string pid) 28 { 29 //这里也要修改数据库连接信息并编译 30 string connectionString="Data Source=.;Initial Catalog=classTree;User ID=sa;pwd=sa;"; 31 SqlConnection conn = new SqlConnection(connectionString); 32 string sql = "select * from classTree where parentId="+pid; 33 SqlCommand cmd = new SqlCommand(sql, conn); 34 SqlParameter parentID = new SqlParameter("@parentID", SqlDbType.Int); 35 parentID.Value = pid; 36 conn.Open(); 37 SqlDataReader sdr = cmd.ExecuteReader(); 38 while (sdr.Read()) 39 { 40 this.DropDownList1.Items.Add(new ListItem(toadd+" "+sdr["className"].ToString(),sdr["id"].ToString())); 41 toadd += "─┴"; 42 this.GetArticleCategory(sdr["id"].ToString()); 43 toadd = toadd.Substring(0, toadd.Length - 2); 44 } 45 sdr.Close(); 46 conn.Close(); 47 48 } 49} 50
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:无限级树形(三层开发)源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146