protected void Page_Load(object sender, EventArgs e)
{
Common.HasLogin();
if (!IsPostBack)
{
treebuild();
}
}
private void treebuild()
{
tyhgl003BLL modulbll = new tyhgl003BLL();
IList list = modulbll.GetAllModule();
//Response.Write(list.Count);
for (int i = 0; i < list.Count; i++)
{
tyhgl003 modual = (tyhgl003)list[i];
TreeNode tn = new TreeNode();
tn.Text = modual.cmkmc;
tn.Value = "0";
tn.NavigateUrl = "#";
TreeView1.Nodes.Add(tn);
subtreeNode(tn,modual.cmkdm);
}
}
private void subtreeNode(TreeNode ptn,string mkdm)
{
tyhgl004BLL Cmodualbll = new tyhgl004BLL();
int count = Cmodualbll.GetChildModualCount(mkdm);
int tempcount = 0;
IList listsub = Cmodualbll.GetChildModualByUser(mkdm,hidUser.Value.Trim());
// IList listsub = Cmodualbll.GetChildModual(mkdm);
// bool IsCheckedParentNode = false; for (int j = 0; j < listsub.Count; j++)
{
tyhgl004 cmodual = (tyhgl004)listsub[j];
TreeNode tn = new TreeNode();
tn.Text = cmodual.ccxmc;
tn.Value = cmodual.ccxdm;
tn.NavigateUrl = "#";
if (cmodual.cqx == "1")
{
tempcount++;
tn.Checked = true;
ListBox1.Items.Add(new ListItem(tn.Text, tn.Value));
}
ptn.ChildNodes.Add(tn);
}
if ((tempcount > 0) && (tempcount == count))
ptn.Checked = true;
}treebuild()函数运行了两次,有谁遇到过这问题,请指教
{
Common.HasLogin();
if (!IsPostBack)
{
treebuild();
}
}
private void treebuild()
{
tyhgl003BLL modulbll = new tyhgl003BLL();
IList list = modulbll.GetAllModule();
//Response.Write(list.Count);
for (int i = 0; i < list.Count; i++)
{
tyhgl003 modual = (tyhgl003)list[i];
TreeNode tn = new TreeNode();
tn.Text = modual.cmkmc;
tn.Value = "0";
tn.NavigateUrl = "#";
TreeView1.Nodes.Add(tn);
subtreeNode(tn,modual.cmkdm);
}
}
private void subtreeNode(TreeNode ptn,string mkdm)
{
tyhgl004BLL Cmodualbll = new tyhgl004BLL();
int count = Cmodualbll.GetChildModualCount(mkdm);
int tempcount = 0;
IList listsub = Cmodualbll.GetChildModualByUser(mkdm,hidUser.Value.Trim());
// IList listsub = Cmodualbll.GetChildModual(mkdm);
// bool IsCheckedParentNode = false; for (int j = 0; j < listsub.Count; j++)
{
tyhgl004 cmodual = (tyhgl004)listsub[j];
TreeNode tn = new TreeNode();
tn.Text = cmodual.ccxmc;
tn.Value = cmodual.ccxdm;
tn.NavigateUrl = "#";
if (cmodual.cqx == "1")
{
tempcount++;
tn.Checked = true;
ListBox1.Items.Add(new ListItem(tn.Text, tn.Value));
}
ptn.ChildNodes.Add(tn);
}
if ((tempcount > 0) && (tempcount == count))
ptn.Checked = true;
}treebuild()函数运行了两次,有谁遇到过这问题,请指教
http://www.cnblogs.com/66feifei/archive/2008/03/01/705721.html