单击子级节点链接后关闭treeview [英] treeview in close after the click subchild node link

查看:69
本文介绍了单击子级节点链接后关闭treeview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

步骤-1)当我的网站打开这样的菜单显示时

http://postimg.org / image / yi7lcuoir / [ ^ ]

步骤-2)然后我点击任何链接然后它的节目如下

http:// postimg.org/image/b77a5xiap/ [ ^ ]

然后我点击红色文字

http://postimg.org/image/xatyzejvb [ ^ ]

step- 3)然后我点击这个页面打开的红色显示,但我的菜单屏幕关闭这样

http: //postimg.org/image/yi7lcuoir/ [ ^ ]

但是我想要这样的

http: //postimg.org/image/xatyzejvb [ ^ ]



我在母版页中使用此代码,所有这些代码都在运行时间内

step -1)when my website open its menu show like this
http://postimg.org/image/yi7lcuoir/[^]
step -2)then aften i click any link then its show like this
http://postimg.org/image/b77a5xiap/[^]
then i click red color text
http://postimg.org/image/xatyzejvb[^]
step-3) then i click which is show in red color this page open but my menu screen close like this
http://postimg.org/image/yi7lcuoir/[^]
but i want like this
http://postimg.org/image/xatyzejvb[^]

and i use this code in master page which all in come in run time

public void BindTree()
  {
      dt.Clear();
      dt = lng.Getlogin_Parent(Session["UserID"].ToString());
      for (i = 0; i < dt.Rows.Count; i++)
      {
          TreeNode no = new TreeNode();
          no.Collapse();
          no.Text = dt.Rows[i]["MENU_DESC"].ToString();
          menuid = Convert.ToInt32(dt.Rows[i]["MENU_ID"]);
          if (dt.Rows[i]["MENU_DESC"].ToString() == "Password Change")
          {
              no.NavigateUrl = "~/PasswordChange/Password/PasswordChange.aspx";
          }
          if (dt.Rows[i]["MENU_DESC"].ToString() == "Exit")
          {
              no.NavigateUrl = "~/Signout.aspx";
          }
          Get_allNodes(no);
          this.tr1.Nodes.Add(no);

      }
  }
  public void Get_allNodes(TreeNode no)
  {
      dt1.Clear();
      dt1 = lng.Getlogin_ParentID(Session["UserID"].ToString(), menuid);
      {
          for (j = 0; j < dt1.Rows.Count; j++)
          {
              TreeNode Child = new TreeNode();
              Child.Collapse();
              Child.Text = dt1.Rows[j]["MENU_DESC"].ToString();
              menuchild = Convert.ToInt32(dt1.Rows[j]["MENU_ID"]);
              if (dt1.Rows[j]["MENU_DESC"].ToString() == "Arrear/AWR Reports")
              {
                  Child.NavigateUrl = "~/Report/ArrearAWRReport/Arrear_report.aspx";
              }

              Get_allNodesSubchild(Child);
              no.ChildNodes.Add(Child);
          }

      }
  }
  public void Get_allNodesSubchild(TreeNode Child)
  {
      dt2.Clear();
      dt2 = lng.Getlogin_ParentID(Session["UserID"].ToString(), menuchild);
      {
          for (k = 0; k < dt2.Rows.Count; k++)
          {
              TreeNode SubChild = new TreeNode();
              SubChild.Collapse();
              SubChild.Text = dt2.Rows[k]["MENU_DESC"].ToString();
              supmenuchild = Convert.ToInt32(dt2.Rows[k]["MENU_ID"]);
              #region
              if (dt2.Rows[k]["MENU_DESC"].ToString() == "Attendance Data Query")
              {
                  SubChild.NavigateUrl = "~/EntryModule/AttendenceModule/AttendanceDataQuery.aspx";
              }
              #endregion
              Get_SuperNodesSubchild(SubChild);
              Child.ChildNodes.Add(SubChild);

          }

      }
  }
  public void Get_SuperNodesSubchild(TreeNode SubChild)
  {
      dt3.Clear();
      dt3 = lng.Getlogin_ParentID(Session["UserID"].ToString(), supmenuchild);
      {
          for (l = 0; l < dt3.Rows.Count; l++)
          {
              TreeNode superchild = new TreeNode();
              superchild.Collapse();
              superchild.Text = dt3.Rows[l]["MENU_DESC"].ToString();
              if (dt3.Rows[l]["MENU_DESC"].ToString() == "Official Master Entry")
              {
                  superchild.NavigateUrl = "~/EntryModule/MasterDataModule/OfficialDataEntry.aspx";
              }

              SubChild.ChildNodes.Add(superchild);
          }
      }
  }





请帮帮我



please help me

推荐答案

检查这些:



http://stackoverflow.com/questions/11128310/asp-net-treeview-keep-the-same-state-after-postback [ ^ ]



http://srinivashelp.blogspot.com/2010/09/retain-treeview-navigation-state-after.html [ ^ ]



希望它帮助



祝你好运
Check these out:

http://stackoverflow.com/questions/11128310/asp-net-treeview-keep-the-same-state-after-postback[^]

http://srinivashelp.blogspot.com/2010/09/retain-treeview-navigation-state-after.html[^]

Hope it helps

Good luck


这篇关于单击子级节点链接后关闭treeview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆