标题:页面左边显示树形菜单,右边显示选中项的信息,怎么实现啊?
只看楼主
sunfly813
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-11-8
 问题点数:0 回复次数:14 
页面左边显示树形菜单,右边显示选中项的信息,怎么实现啊?
rt
需要在页面左边根据数据库显示树形菜单并能逐级展开和选择,然后相应的在页面右边显示被选择的项的数据库查询信息,应该怎么下手啊?
偶是初学者,望指点!最好有示例的代码~~
在网上搜索了半天,基本都要用到treeview控件,可是找不到下载地址,哪位有的话希望可以分享一下~~
搜索更多相关主题的帖子: 树形 数据库 菜单 页面 搜索 
2007-08-01 03:54
foshan
Rank: 1
等 级:新手上路
威 望:2
帖 子:605
专家分:0
注 册:2006-3-1
得分:0 

<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="z-index: 105; left: 670px; width: 100px; position: absolute; top: 7px; height: 100px">
<asp:Label ID="Label5" runat="server" Text="功能菜单" Width="74px" CssClass="contextMenuTrigger" BackColor="#FF8000" Font-Bold="True"></asp:Label><br />
<asp:Panel ID="panelMenu" runat="server" Height="50px" Width="125px" CssClass="contextMenuPanel" Style="display: none;">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:HyperLink ID="HyperLink12" runat="server" NavigateUrl="~/JianYu/ShiGongHeTong/HeTongLiuLan.aspx" Target="_blank" CssClass="contextMenuItem">合同浏览</asp:HyperLink>
<asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl="~/JianYu/ShiGongHeTong/Htgl.aspx" Target="_blank" CssClass="contextMenuItem">施工合同管理</asp:HyperLink>
<asp:HyperLink ID="HyperLink14" runat="server" NavigateUrl="~/JianYu/ShiGongHeTong/Htwdgl.aspx" Target="_blank" CssClass="contextMenuItem" Width="140px">施工合同文档管理</asp:HyperLink>
<asp:HyperLink ID="HyperLink16" runat="server" NavigateUrl="~/JianYu/GuanLiHeTong/Gcxxglhtgl.aspx" Target="_blank" CssClass="contextMenuItem">管理合同管理</asp:HyperLink>
<asp:HyperLink ID="HyperLink15" runat="server" NavigateUrl="JianYu/GongChengGaiKuang/gongchenggaikuang_dj.aspx" Target="_blank" CssClass="contextMenuItem">工程概况录入</asp:HyperLink>
<asp:HyperLink ID="HyperLink7" runat="server" NavigateUrl="~/Admin/Addgcxm.aspx" Target="_blank" CssClass="contextMenuItem">工程项目设置</asp:HyperLink>
<asp:HyperLink ID="HyperLink8" runat="server" NavigateUrl="~/Admin/Addhtfl.aspx" Target="_blank" CssClass="contextMenuItem">合同分类设置</asp:HyperLink>
<asp:HyperLink ID="HyperLink9" runat="server" NavigateUrl="~/Admin/Addzygcfl.aspx" Target="_blank" CssClass="contextMenuItem">专业分类设置</asp:HyperLink>
<asp:HyperLink ID="HyperLink17" runat="server" NavigateUrl="~/Admin/AddGuanLiXiangMuFenLei.aspx" Target="_blank" CssClass="contextMenuItem">管理项目设置</asp:HyperLink>
<asp:HyperLink ID="HyperLink10" runat="server" NavigateUrl="~/JianYu/Tzctck.aspx" CssClass="contextMenuItem" Target="_blank">出图及会审情况</asp:HyperLink>
<asp:HyperLink ID="HyperLink13" runat="server" NavigateUrl="JianYu/Llshigongdanwei.aspx" CssClass="contextMenuItem" Target="_blank">施工单位查询</asp:HyperLink>
<asp:HyperLink ID="HyperLink11" runat="server" NavigateUrl="JianYu/shigongdanweigl.aspx" CssClass="contextMenuItem" Target="_blank">施工单位管理</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/JianCheng/Jsjlsj.aspx" Target="_blank" CssClass="contextMenuItem">建诚结算资料收集</asp:HyperLink>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/JianYu/Jujsjh.aspx" CssClass="contextMenuItem" Target="_blank">建宇结算计划</asp:HyperLink>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ZiHui/Zhjsjh.aspx" Target="_blank" CssClass="contextMenuItem">紫晖结算计划</asp:HyperLink>
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/ZiHui/Zhtbydwcck.aspx" Target="_blank" CssClass="contextMenuItem">填报月度完成</asp:HyperLink>
<asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl="~/JianYu/ShiGongHeTong/Jszjsr.aspx" Target="_blank" CssClass="contextMenuItem">结算录入</asp:HyperLink>
<asp:LinkButton ID="LinkButton4" runat="server" OnClick="LinkButton4_Click" CssClass="contextMenuItem">既往报表下载</asp:LinkButton>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" CssClass="contextMenuItem">文件操作</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButton2_Click" CssClass="contextMenuItem">更改密码</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
<asp:LinkButton ID="LinkButton5" runat="server" OnClick="LinkButton5_Click" CssClass="contextMenuItem">导出Excel</asp:LinkButton>
<a href="#" class="contextMenuItem"> <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox2_CheckedChanged"
Text="仅显示月度完成" Width="140px"/></a>
<a href="#" class="contextMenuItem"> <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged"
Text="仅显示结算计划" Width="140px"/></a>
<a href="#" class="contextMenuItem"><asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox3_CheckedChanged"
Text="启用分页功能" Width="140px" Checked="true" /></a>
</asp:Panel>
</div>
<ajaxToolkit:DropDownExtender ID="DropDownExtender1" runat="server" TargetControlID="Label5" DropDownControlID="panelMenu">
</ajaxToolkit:DropDownExtender>

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div style="position: absolute; top: 200px; left: -398px; width: 103%; text-align: right; z-index: 106;">
<img src="Images/busy.gif" alt="数据加载中……" /><span style="background-color: rgb(204, 68, 68);">数据加载中……</span>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<div style="z-index: 104; left: 335px; width: 390px; position: absolute; top: 5px;
height: 25px">
&nbsp;<asp:DropDownList ID="DropDownList1" runat="server" Width="60px" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="2007"></asp:ListItem>
<asp:ListItem Value="2008"></asp:ListItem>
<asp:ListItem Value="2009"></asp:ListItem>
<asp:ListItem Value="2010"></asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label4" runat="server" Text="年"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" Width="60px" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged">
<asp:ListItem Value="9"></asp:ListItem>
<asp:ListItem Value="10"></asp:ListItem>
<asp:ListItem Value="11"></asp:ListItem>
<asp:ListItem Value="12"></asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label2" runat="server" Text="月工程结算情况一览表"></asp:Label>
</div>
<div>
<asp:Label ID="Label1" runat="server" Text="项目名称"></asp:Label><br />
<asp:Panel ID="Panel1" runat="server" Height="260px" ScrollBars="Both" Width="163px" BorderColor="GradientInactiveCaption" BorderStyle="Double">
<asp:TreeView ID="TreeView1" runat="server" Font-Size="Small" OnSelectedNodeChanged="TreeView1_SelectedNodeChanged"
ShowLines="True">
<SelectedNodeStyle BackColor="#FFE0C0" />
</asp:TreeView>
</asp:Panel>
</div>
<div style="z-index: 103; left: 183px; width: 401px; position: absolute; top: 33px;
height: 228px">
<asp:Panel ID="Panel3" runat="server" Height="527px" ScrollBars="Both" Width="784px" BorderColor="GradientInactiveCaption" BorderStyle="Double">
<asp:UpdatePanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:GridView id="GridView1" runat="server" Width="1426px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" AutoGenerateColumns="False" GridLines="None" OnRowDataBound="GridView1_RowDataBound" EmptyDataText="数据不存在……" OnRowCreated="GridView1_RowCreated" CellSpacing="2" CellPadding="3" BorderWidth="1px" BorderStyle="None" BorderColor="#DEBA84" BackColor="#DEBA84" Font-Size="Smaller" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510"></FooterStyle>
<Columns>
<asp:BoundField DataField="jsID" HeaderText="ID" >
<HeaderStyle Width="0px" CssClass="hidden" />
<ItemStyle CssClass="hidden" />
<FooterStyle CssClass="hidden" />
</asp:BoundField>
<asp:BoundField DataFormatString="{0}" DataField="gcmc" HeaderText="工程名称">
<ItemStyle Width="50px"></ItemStyle>
<ControlStyle BackColor="#FFFFC0" />
<HeaderStyle BackColor="#FFFFC0" ForeColor="Black" />
</asp:BoundField>
<asp:BoundField DataFormatString="{0}" DataField="sgdw" HeaderText="施工单位">
<ItemStyle Width="80px"></ItemStyle>
<HeaderStyle BackColor="#FFFFC0" ForeColor="Black" />
</asp:BoundField>
<asp:BoundField DataField="htjj" HeaderText="合同造价&lt;br/&gt;(元)" DataFormatString="{0:N}" HtmlEncode="False">
<ItemStyle Width="50px" HorizontalAlign="Right"></ItemStyle>
<HeaderStyle BackColor="#FFFFC0" ForeColor="Black" />
</asp:BoundField>
<asp:BoundField DataField="kgrq" HeaderText="开工日期">
<ItemStyle Width="50px"></ItemStyle>
<HeaderStyle BackColor="#FFFFC0" ForeColor="Black" />
</asp:BoundField>
<asp:BoundField DataField="nsrq" HeaderText="验收日期">
<ItemStyle Width="50px"></ItemStyle>
<HeaderStyle BackColor="#FFFFC0" ForeColor="Black" />
</asp:BoundField>
<asp:BoundField DataField="bz3" HeaderText="备注">
<ItemStyle Width="50px"></ItemStyle>
</asp:BoundField>
</Columns>
<PagerTemplate>
<table width="100%">
<tr>
<td style="text-align:left">
第<asp:Label id="lblPageIndex" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label id="lblPageCount" runat="server" text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:linkbutton id="btnFirst" runat="server" causesvalidation="False" commandargument="First" commandname="Page" text="首页" />
<asp:linkbutton id="btnPrev" runat="server" causesvalidation="False" commandargument="Prev" commandname="Page" text="上一页" />
<asp:linkbutton id="btnNext" runat="server" causesvalidation="False" commandargument="Next" commandname="Page" text="下一页" />
<asp:linkbutton id="btnLast" runat="server" causesvalidation="False" commandargument="Last" commandname="Page" text="尾页" />
<asp:textbox id="txtNewPageIndex" runat="server" width="20px" text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />
<asp:linkbutton id="btnGo" runat="server" causesvalidation="False" commandargument="-1" commandname="Page" text="GO" /><!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
</td>
</tr>
</table>
</PagerTemplate>
<RowStyle BackColor="#E3EAEB" ForeColor="#8C4510" Wrap="False"></RowStyle>
<SelectedRowStyle BackColor="#738A9C" ForeColor="Blue" Font-Bold="True"></SelectedRowStyle>
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="#A55129" ForeColor="White" Font-Bold="True"></HeaderStyle>
<AlternatingRowStyle BackColor="OldLace" BorderStyle="None"></AlternatingRowStyle>
</asp:GridView> &nbsp;&nbsp;
</contenttemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>
<asp:AsyncPostBackTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>
<asp:AsyncPostBackTrigger ControlID="TreeView1" EventName="SelectedNodeChanged"></asp:AsyncPostBackTrigger>
<asp:AsyncPostBackTrigger ControlID="TreeView2" EventName="SelectedNodeChanged"></asp:AsyncPostBackTrigger>
<asp:AsyncPostBackTrigger ControlID="CheckBox1" EventName="CheckedChanged" />
<asp:AsyncPostBackTrigger ControlID="CheckBox2" EventName="CheckedChanged" />
<asp:AsyncPostBackTrigger ControlID="CheckBox3" EventName="CheckedChanged" />
</Triggers>
</asp:UpdatePanel>
<br />
&nbsp;</asp:Panel>
</div>
<br />
<asp:Label ID="Label3" runat="server" Text="合同分类"></asp:Label><br />
<asp:Panel ID="Panel2" runat="server" Height="224px" ScrollBars="Both" Width="164px" BorderColor="GradientInactiveCaption" BorderStyle="Double">
<asp:TreeView ID="TreeView2" runat="server" Font-Size="Small" OnSelectedNodeChanged="TreeView2_SelectedNodeChanged"
ShowLines="True">
<SelectedNodeStyle BackColor="#FFE0C0" />
</asp:TreeView>
</asp:Panel>
&nbsp;&nbsp;&nbsp; &nbsp;
</form>
</body>
</html>


我是2.0超级菜鸟,请多多教导!
2007-08-01 09:41
冰彩虹
Rank: 4
来 自:上海
等 级:贵宾
威 望:14
帖 子:806
专家分:44
注 册:2007-6-28
得分:0 
treeview的数据绑定一般都用到递归方法来逐个添加节点

在选中事件中获取选中节点信息显示在页面右边即可了

Flying without wings
2007-08-01 09:53
sunfly813
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-11-8
得分:0 
回复:(foshan)

我把你的代码贴到.aspx文件里,执行出错,如下:
“/123/WebApplication2”应用程序中的服务器错误。
--------------------------------------------------------------------------------

分析器错误
说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。

分析器错误信息: 未能从程序集 System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 中加载类型 System.Web.UI.WebControls.ScriptManager。

源错误:


行 6: <body>
行 7: <form id="form1" runat="server">
行 8: <asp:ScriptManager ID="ScriptManager1" runat="server">
行 9: </asp:ScriptManager>
行 10: <div style="z-index: 105; left: 670px; width: 100px; position: absolute; top: 7px; height: 100px">

源文件: F:\123\WebApplication2\WebForm3.aspx 行: 8

我的.net版本信息是这样的:Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573

请问是对版本有要求吗?还是我使用代码的方式不对?

2007-08-01 10:14
sunfly813
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-11-8
得分:0 
回复:(冰彩虹)treeview的数据绑定一般都用到递归方...

嗯,应该怎么划分页面的布局呢?定位左边显示树状,右边显示信息?
请说的详细些好吗?谢谢!

2007-08-01 10:16
冰彩虹
Rank: 4
来 自:上海
等 级:贵宾
威 望:14
帖 子:806
专家分:44
注 册:2007-6-28
得分:0 
左边放treeview,右边放panel(隐藏)

选中节点时,显示panel

Flying without wings
2007-08-01 10:22
sunfly813
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-11-8
得分:0 
回复:(冰彩虹)左边放treeview,右边放panel(隐藏)...

请问你那儿有没有treeview的那个控件集的代码啊?
我安装的.net里的Web应用程序中没有这个控件,看网上好多都说可以下载并安装,可是我找了半天都下不到~

2007-08-01 11:04
冰彩虹
Rank: 4
来 自:上海
等 级:贵宾
威 望:14
帖 子:806
专家分:44
注 册:2007-6-28
得分:0 
不会吧,工具箱里的导航栏目下没有TreeView控件??

在找找看,瞪大眼睛再找找,哈哈哈

Flying without wings
2007-08-01 11:37
cyyu_ryh
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:1899
专家分:176
注 册:2006-10-21
得分:0 
用框架在动态邦定TreeView即在数据库中读取数据帮助上有

有事无事都密我. MSN: cyyu_ryh@hotmail.co.jp E-mail: cyyu_ryh@
2007-08-01 11:48
sunfly813
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2006-11-8
得分:0 
回复:(冰彩虹)不会吧,工具箱里的导航栏目下没有Tr...
已经找了N多次了,是没有啊~~
我装的是.net2003,选择ASP Web程序设计的话工具栏里没有,但是选择Windows 窗体程序设计的话,工具栏里就有~
可是我想用的是Web程序设计~
2007-08-01 11:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-159566-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.276101 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved