C#实现类似MSDN帮助文档,点击左边管理树节点右边出现相对应内容。 最近正在用C#做一个C/S程序,程序界面用splitcontain为左右两部分,左部放置一个管理树,当点击一个节点的时候,能从右边显示与此节点相对应的内容,就如同MSDN帮助文档的这种形式,但是不知道如果实现呢?请朋友们帮忙想想办法。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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"> <strong>科学分类</strong> </td> <td class="style2"> </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> </tr> <tr> <td valign="top" class="style1"> <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; } } }}不明白问我,可能是你想得太复杂了吧,一个表格二个列,左边树形,右边数据控件~~ afterslect也不能选择相应节点啊 右边放和node相同数量的pannel ,每个panel上面可以放不同控件.afterselected控制对应panel的BringToFront; 需要注意的是:1.所有panel的位置\大小一致.2.所有panel的父容器一致,panel之间不能出现包含关系,(看Designer.cs文件).3.怎么将node和panel关系起来? 简单的方法用node的tag记录对应panel的name. 怎么样对node节点编程呢?比如点击某个节点的时候可以出现一个弹出窗口 树图的afterSelect 事件 再弱弱地问一句:如何编写afterselect事件呢 帮忙挑个错 今天第三贴...问下事务提醒窗口提示 c# 多语言:如何是状态行的文字也能多语言切换? 在公司里的困惑 为自动填充列调整大小期间不能执行此操作。该怎么办?? 通过拖动字段到FORM后如何实现行滚动 &&&&&&&&&&&&&&&********求助:如何用C#编写录音程序**********&&&&&&&&&&&&&&&&& 向数据库添加记录的问题,请高手看看错误在那哦? 关于字符串编码的问题 图片转base64编码 多列子查询少了个','号 刚装老个WIN2008
<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">
<strong>科学分类</strong> </td>
<td class="style2"> </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>
</tr>
<tr>
<td valign="top" class="style1">
<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;
}
}
}
}
不明白问我,可能是你想得太复杂了吧,一个表格二个列,左边树形,右边数据控件~~
afterselected控制对应panel的BringToFront;
1.所有panel的位置\大小一致.
2.所有panel的父容器一致,panel之间不能出现包含关系,(看Designer.cs文件).
3.怎么将node和panel关系起来? 简单的方法用node的tag记录对应panel的name.