救命啊!关于treeview!

bogeymanhome 2004-04-30 01:14:46
我的treeview是动态加载接点,当点击根接点时自动加载第一及子接点,这个没有错误,可是当我点击动态加载的第一及子节点时再也无法加载下一及子接点了?搞的头都大了,救命啊!
...全文
24 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
bogeymanhome 2004-04-30
大侠,取得跟目录没问题,但是到第二几怎么不行了呢?那个+号也没有,哪里出的问题啊?非常感谢!
  • 打赏
  • 举报
回复
morality 2004-04-30
http://www.blueidea.com/tech/program/2003/931.asp
  • 打赏
  • 举报
回复
wangsaokui 2004-04-30
参考

Create three .aspx files

TreeViewDataSet.aspx

<%@ import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IE" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %>

<html>
<head>
<title>
TreeViewDataSet.aspx
</title>
</head>
<body>
<form runat="Server">
<IE:TreeView
AutoPostBack="True"
TreeNodeSrc="Categories.aspx"
Runat="Server"/>
</form>
</body>
</html>

Categories.aspx
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<Script runat="Server">
sub page_load
Dim mycon as SqlConnection
Dim cmdCategories As SqlCommand
Dim dsCategories As DataSet
Dim strQuery As String

mycon=New Sqlconnection("Server=localhost;UID=sa;PWD=secret;Database=Northwind")
strQuery="select categoryname as Text,'products.aspx?catid='
+LTRIM(STR(CategoryID))" & _
"As TreeNodeSrc from Categories As TreeNode for xml auto, XMLDATA"
cmdCategories=new SqlCommand(strQuery,mycon)
dsCategories=New DataSet
dsCategories.ReadXML(cmdCategories.ExecuteXmlReader(),XmlReadMode.Fragment)
dsCategories.DataSetName="TREENODES"
dsCategories.WriteXml(Response.OutputStream)
end sub
</script>

Products.aspx
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<Script runat="Server">
sub page_load
Dim mycon as SqlConnection
Dim cmdProducts As SqlCommand
Dim dsProducts As DataSet
Dim strQuery As String

mycon=New Sqlconnection("Server=localhost;UID=sa;PWD=secret;Database=Northwind")
strQuery="select Productname as Text from products As TreeNode" & _
" where CategoryID=@categoryID for xml auto, XMLDATA "
cmdproducts=new SqlCommand(strQuery,mycon)
cmdproducts.Parameters.Add(New SqlParameter("@categoryID",Request.QueryString("catID")))
mycon.open()
dsproducts=New DataSet
dsproducts.ReadXML(cmdproducts.ExecuteXmlReader(),XmlReadMode.Fragment)
dsproducts.DataSetName="TREENODES"
dsproducts.WriteXml(Response.OutputStream)
mycon.close()
end sub
</script>
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2004-04-30 01:14
社区公告
暂无公告