private void MakeTree(Infragistics.WebUI.UltraWebNavigator.Node pnode)
{
if(ds!=null&&ds.Tables[0].Rows.Count>0)
{
foreach(DataRow dr in ds.Tables[0].Select("DEP_PARENT_ID='"+pnode.Tag.ToString()+"'"))
{
if(dr["DEP_ID"].ToString()!="0")
{
Infragistics.WebUI.UltraWebNavigator.Node node=new Infragistics.WebUI.UltraWebNavigator.Node();
node.Text=dr["DEP_NAME"].ToString();
node.Tag=dr["DEP_ID"].ToString();
node.Expanded=true;
pnode.Nodes.Add(node);
MakeTree(node);
}
}
}
else
{
k++;
if(k==1)
{
UltraWebTree1.SelectedNode = pnode;
this.hdFID.Value=pnode.Tag.ToString();
}
}
}
private void LoadData()
{
try
{
DepTree dt=new DepTree();
Infragistics.WebUI.UltraWebNavigator.Node RootNode=new Infragistics.WebUI.UltraWebNavigator.Node();
DEP dep = dt.getDep("0");
RootNode.Tag=dep.DEP_ID;
RootNode.Text=dep.DEP_NAME;
RootNode.ImageUrl="../../../images/orgnodes/rootdep.gif";
RootNode.Expanded=true;
UltraWebTree1.Nodes.Add(RootNode);
ds = dt.getDep();
MakeTree(RootNode);
}
catch(Exception ex)
{
MessageBox mb=new MessageBox();
mb.ShowAndRedirect(this,ex.Message,"../../Frame/Error.aspx?ErrorMessage="+ex.Message);
}
}