首页 > 开发 > 综合 > 正文

用dataset来填充tree

2024-07-21 02:23:23
字体:
来源:转载
供稿:网友
1,<iewc:treeview id=treeview1 style="z-index: 101; left: 152px; position: absolute; top: 168px" treenodesrc="categories.aspx" runat="server">
2,categories.aspx.cs

private void page_load(object sender, system.eventargs e)
{
string [email protected]"select categoryname as text,'products.aspx?catid='+ltrim(str(categoryid)) as treenodesrc
from categories as treenode for xml auto ,xmldata " ;
sqlconnection sqlconn=new sqlconnection("server=dbm-1;uid=sa;pwd=;database=northwind");
sqlcommand com=new sqlcommand (sql,sqlconn);
dataset ds=new dataset();
sqlconn .open();
ds.readxml(com.executexmlreader(),xmlreadmode.fragment );
sqlconn.close();
sqlconn=null;

ds.datasetname ="treenodes";
ds.writexml(response.outputstream );

}

国内最大的酷站演示中心!
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表