最近正在用C#做一个C/S程序,程序界面用splitcontain为左右两部分,左部放置一个管理树,当点击一个节点的时候,能从右边显示与此节点相对应的内容,就如同MSDN帮助文档的这种形式,但是不知道如果实现呢?请朋友们帮忙想想办法。

解决方案 »

  1.   

     <table border="0" cellpadding="0" cellspacing="0" style="width: 1000px;">
      <tr>
    <td style="background: #056798; height: 100%;" valign="top">
     </td>
    <td valign="top" align="left">
     <div style="float: left; margin: 5px 0 0 9px; width: 828px; text-align: left; color: #235570;">
                                    <div style="margin: 5px 0 10px 4px; text-align: left; width: 820px;">
                                        <div style="float: left; width: 515px;">
                                            您的当前位置:资源目录
                                        </div>
                                    </div>
                                    <div id="DIV2" style="width: 822px;">
                                        <table style="width: 100%;">
                                            <tr>
                                                <td class="style2">
                                                    &nbsp;
                                                   <strong>科学分类</strong> </td>
       <td class="style2">&nbsp;                                                </td>      </tr>
          <tr>
        <td valign="top" class="style1">
            <asp:TreeView ID="TreeView1" ImageSet="Faq"  ShowLines="True" runat="server" 
                Font-Size="Small" ForeColor="Black">
            </asp:TreeView>
            </td>
                                                <td valign="top" rowspan="2">
                                                    <asp:Literal ID="Literal1" runat="server"></asp:Literal><asp:Literal ID="Literal2"
                                                        runat="server"></asp:Literal><br />                                                <asp:Repeater ID="Repeater1" runat="server">
                                                    <ItemTemplate>
                                                    
                                           
                                            <div style="margin: 5px 0 0  20px; float: left;  line-height:18px; word-wrap: break-word; word-break: break-all;">
                                                <nobr><a href="csqx_category_message1.aspx?type=<%# Eval("Article_ID") %>" target="_blank">
                                          <%# Eval("article_Title") %>
                                    </a></nobr>
                                            </div>
                                                    </ItemTemplate>
                                                    </asp:Repeater>
                                                </td>
                                                    &nbsp;
      
                                            </tr>
                                                                   <tr>
                                                <td valign="top" class="style1">
                                                    &nbsp;&nbsp;
                                                  <strong> icd10  类 </strong> <BR /> <asp:TreeView ID="TreeView2" ImageSet="Faq"  ShowLines="True" runat="server" 
                Font-Size="Small" ForeColor="Black">
            </asp:TreeView>
            
            
                                                </td>
                                            </tr>
                                      </table>
                                    </div>                
                                </div>
                            </td>
                        </tr>
                    </table>CS页public partial class introduct : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {            DataTable dt1 = ScienceTypeHandle.GetList1().Tables[0];
                foreach (DataRow row1 in dt1.Rows)
                {
                    TreeNode tn = new TreeNode();
                    tn.Text = row1["TypeTitle"].ToString();
                    tn.Value = row1["ID"].ToString();
                    tn.NavigateUrl = "introduct.aspx?ID=" + tn.Value.Trim() + "&FID=1&GID=1&UID=" + tn.Text.Trim();
                    
                    this.TreeView1.Nodes.Add(tn);
                    DataTable dt2 = ScienceTypeHandle.GetList2(Convert.ToInt32(row1["ID"])).Tables[0];
                    foreach (DataRow row2 in dt2.Rows)
                    {
                        TreeNode tn2 = new TreeNode();
                        tn2.Text = row2["TypeTitle"].ToString();
                        tn2.Value = row2["ID"].ToString();
                        tn2.NavigateUrl = "introduct.aspx?ID=" + tn2.Value.Trim() + "&FID=1&GID=2&UID=" + tn.Text.Trim() + "&BID=" + tn2.Text.Trim();
                        tn.ChildNodes.Add(tn2);
                                       }
                }
                DataTable dt11 = Icd10Handle.GetList1().Tables[0];
                foreach (DataRow row11 in dt11.Rows)
                {
                    TreeNode tn1 = new TreeNode();
                    tn1.Text = row11["TypeTitle"].ToString();
                    tn1.Value = row11["ID"].ToString();
                    tn1.NavigateUrl = "introduct.aspx?ID=" + tn1.Value + "&FID=2&GID=1&UID=" + tn1.Text.Trim();
                    this.TreeView2.Nodes.Add(tn1);
                    DataTable dt21 = Icd10Handle.GetList2(Convert.ToInt32(row11["ID"])).Tables[0];
                    foreach (DataRow row21 in dt21.Rows)
                    {
                        TreeNode tn21 = new TreeNode();
                        tn21.Text = row21["TypeTitle"].ToString();
                        tn21.Value = row21["ID"].ToString();
                        tn21.NavigateUrl = "introduct.aspx?ID=" + tn21.Value + "&FID=2&GID=2&UID=" + tn1.Text.Trim() + "&BID=" + tn21.Text.Trim();
                        tn1.ChildNodes.Add(tn21);
                   }
                    
                }
                this.TreeView1.CollapseAll();
                this.TreeView2.CollapseAll();            if (Request.QueryString["ID"] != null)
                {
               
                    if (Request.QueryString["UID"] != null && Request.QueryString["BID"]==null)
                    {
                        this.Literal1.Text = Request.QueryString["UID"].ToString();
                        this.Literal2.Visible = false;
                    }
                    if (Request.QueryString["BID"] != null)
                    {
                        this.Literal1.Text = Request.QueryString["UID"].ToString();
                        this.Literal2.Text = "--" + Request.QueryString["BID"].ToString();
                
                    }
                    if (Request.QueryString["FID"].ToString() == "1")
                    {
                        if (Request.QueryString["GID"].ToString() == "1")
                        {
                            Repeater1.DataSource =articleHandle.GetListAllKXID(Convert.ToInt32(Request.QueryString["ID"]));
                            Repeater1.DataBind();
                        }
                        else 
                        {
                            Repeater1.DataSource = articleHandle.GetListAllKXID2(Convert.ToInt32(Request.QueryString["ID"]));
                            Repeater1.DataBind();
                        }
                       
                    }
                    else 
                    {
                          if (Request.QueryString["GID"].ToString() == "1")
                        {
                            Repeater1.DataSource = articleHandle.GetListAllCDID(Convert.ToInt32(Request.QueryString["ID"]));
                            Repeater1.DataBind();
                        }
                        else 
                        {
                            Repeater1.DataSource = articleHandle.GetListAllCDID2(Convert.ToInt32(Request.QueryString["ID"]));
                            Repeater1.DataBind();
                        }
                   }
                 }
                else 
                {
                    this.Literal2.Visible = false;
                    this.Literal1.Visible = false;
                    this.Repeater1.Visible = false;
                }
              }
        }
    }
    不明白问我,可能是你想得太复杂了吧,一个表格二个列,左边树形,右边数据控件~~
      

  2.   

    afterslect也不能选择相应节点啊
      

  3.   

    右边放和node相同数量的pannel ,每个panel上面可以放不同控件.
    afterselected控制对应panel的BringToFront;
      

  4.   

    需要注意的是:
    1.所有panel的位置\大小一致.
    2.所有panel的父容器一致,panel之间不能出现包含关系,(看Designer.cs文件).
    3.怎么将node和panel关系起来? 简单的方法用node的tag记录对应panel的name.
      

  5.   

    怎么样对node节点编程呢?比如点击某个节点的时候可以出现一个弹出窗口
      

  6.   

    树图的afterSelect  事件
      

  7.   

    再弱弱地问一句:如何编写afterselect事件呢