日期:2014-05-20  浏览次数:20413 次

TreeView的连接可否带参数?
如何让TREEVIEW里所有的叶子接点的连接都带上参数啊?

比如     a.aspx?id=参数

这个参数是网页传入的值

------解决方案--------------------
private void InitTree(TreeNodeCollection Nds, string parentId)
{
DataView DView = new DataView();
TreeNode TN_tmp;
DView.Table = mySet.Tables[ "AcctModule "];
DView.RowFilter = "ParentId= ' " + parentId + " ' ";
TN_tmp = new TreeNode();
foreach (DataRowView drv in DView)
{
TN_tmp = new TreeNode();
TN_tmp.Value = drv[ "ModID "].ToString();
TN_tmp.Text = drv[ "ModuleName "].ToString();
TN_tmp.ImageUrl = drv[ "CloseIcon "].ToString();
TN_tmp.NavigateUrl = drv[ "LinkPath "].ToString();//此处就是在设置链接地址
TN_tmp.Target = drv[ "TargetFrame "].ToString();
if (TN_tmp.NavigateUrl.Trim() == " ")
TN_tmp.SelectAction = TreeNodeSelectAction.Expand;
else
TN_tmp.SelectAction = TreeNodeSelectAction.Select;

Nds.Add(TN_tmp);
InitTree(TN_tmp.ChildNodes, TN_tmp.Value);
}
}
------解决方案--------------------
哦~