需要在页面左边根据数据库显示树形菜单并能逐级展开和选择,然后相应的在页面右边显示被选择的项的数据库查询信息,应该怎么下手啊?
偶是初学者,望指点!最好有示例的代码~~
在网上搜索了半天,基本都要用到treeview控件,可是找不到下载地址,哪位有的话希望可以分享一下~~
<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">
<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="合同造价<br/>(元)" 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>
</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 />
</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>
</form>
</body>
</html>
我把你的代码贴到.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
请问是对版本有要求吗?还是我使用代码的方式不对?