vs2015 dynamicweb9-3 treeview和sitemap的使用

258 篇文章 2 订阅

web.sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/WebForm1.aspx" title="主页"  description="主页">
    <siteMapNode url="~/SignIn.aspx" title="登录"  description="登录" />
    <siteMapNode url="~/Register.aspx" title="注册"  description="注册" />
    <siteMapNode url="~/PersonalInfo" title="个人信息"  description="个人信息" />

    <siteMapNode url="" title="学生信息"  description="学生信息" >
      <siteMapNode url="~/Student/StudentInfo.aspx" title="学生信息管理"  description="学生信息管理" />
      <siteMapNode url="~/Student/AddStudent.aspx" title="添加学生信息"  description="添加学生信息" />
      <siteMapNode url="~/Student/Search.aspx" title="查询学生信息"  description="查询学生信息" />
      <siteMapNode url="~/Student/MajorResults.aspx" title="查询专业成绩"  description="查询专业成绩" />
    </siteMapNode>
    <siteMapNode url="~/Feedback.aspx" title="建议反馈" decripttion="建议反馈" />
  </siteMapNode>
</siteMap>

masterpage.master

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="dyanmicweb9_3.MasterPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
        *, html, body {
            margin:0;
            padding:0;
        }
        .top {
            width:100%;
            height:100px;
            background-color:#00b22d;
        }
        .top .logo {
            display:inline-block;
            width:50%;
            height:60px;
            margin-top:20px;
            margin-left:100px;
            color:white;
            font-weight:bold;
            font-size:30px;
            line-height:60px;
            font-family:楷体;
        }
        .left_side {
            width:215px;
            height:510px;
            border:1px solid #cccccc;
            background-color:#eeeeee;
            overflow-x:scroll;
            overflow-y:auto;
            float:left;
        }
        .main {
            width:1100px;
            min-height:510px;
            float:left;

        }

        .main .feed {
            width:400px;
            height:300px;
            margin:0 auto;
            padding:20px;

        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div class="top">
            <span class="logo">某某学生管理系统</span>
        </div>
    <div class="left_side">
        <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ExpandDepth="1" ImageSet="Arrows" Width="100%">
            <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
            <NodeStyle Font-Names="Tahoma" Font-Size="10pt" ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
            <ParentNodeStyle Font-Bold="False" />
            <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" />
        </asp:TreeView>
        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    </div>
    <div class="main">
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="dyanmicweb9_3.WebForm1"  MasterPageFile="~/MasterPage.Master"%>
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <center><h3>主页</h3></center>
</asp:Content>

feedback.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Feedback.aspx.cs" Inherits="dyanmicweb9_3.Feedback" MasterPageFile="~/MasterPage.Master" %>
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div class="feed">
        <asp:Label ID="Label1" runat="server" Text="建议"></asp:Label><br />
        <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Width="300px" Height="200px"></asp:TextBox><br />
        <asp:Button ID="Button1" runat="server" Text="提交" Width="80px" Height="30px" OnClick="Button1_Click"/>
    </div>
</asp:Content>

feedback.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace dyanmicweb9_3
{
    public partial class Feedback : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(TextBox1.Text))
            {
                Response.Write("<script>window.alert('感谢提交意见')</script>");
                TextBox1.Text = "";
            }
                
        }
    }
}

web.config

<?xml version="1.0" encoding="utf-8"?>

<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      <siteMap>
        <providers>
          <remove name="MySqlSiteMapProvider" />
        </providers>
      </siteMap>
    </system.web>

</configuration>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虾米大王

有你的支持,我会更有动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值