急.....初始化从数据库中读取所有数据动态生成TreeView目录,然后根据查询条件生成相应的树型结构
目录树至少有四级,初始化从数据库中读取所有数据动态生成TreeView目录,然后可以根据查询条件生成相应的树型结构,并指定节点相应的链接页面.
现在存在的问题是,生成出来的节点查询后无法动态生成相应链接,而且初始化生成的节点链接的ID值都不正确.(代码如下)
//递归绑定同一个表数据
private void InitTree()
{
DataTable dt = GetTreeViewTable();
DataView dv = new DataView(dt);
string Gvalue, bvalue, dvalue, hvalue;
Gvalue = DwGdj.SelectedValue.ToString();
bvalue = DwBdz.SelectedValue.ToString();
dvalue = Dwdy.SelectedValue.ToString();
hvalue = Dwhy.SelectedValue.ToString();
if (Gvalue != " ") { dv.RowFilter = "SubBureauid= ' " + Gvalue + " ' "; }
if (bvalue != " ") { dv.RowFilter = "tsid= ' " + bvalue + " ' "; }
if (dvalue != " ") { dv.RowFilter = "vrid= ' " + dvalue + " ' "; }
if (hvalue != " ") { dv.RowFilter = "tradeid= ' " + hvalue + " ' "; }
if (Gvalue == " " & bvalue == " " & dvalue == " " & hvalue == " ") { dv.RowFilter = "[Parent]= '0 ' "; }
string sUrl = string.Empty;
foreach (DataRowView drv in dv)
{
TreeNode node = new TreeNode();
if (WasteGroup.Checked == true)
{
node.Text = drv[ "WGName "].ToString();
node.Value = drv[ "WGid "].ToString();
&nbs