简单的asp.net模拟邮箱系统基础实现(二 (3)具体版块功能的实现及关键代码之母版页和写信界面)


 

 

母版页

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="email.SiteMaster" %>

 

<!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">

        .auto-style1 {

           font-size:20px;

            padding-top:10px;

           Height:30px;

           Width:100px;

            

        }

        .auto_style4{

           font-size:10px;      

           Height:30px;

           Width:100px;

            

        }

           

         .auto-style2 {

             height: 40px;

         }

           

    </style>

 

</head>

<body>

    <form runat="server">

        <div>

        <div style="float:left">

        <asp:image runat="server" ImageUrl="~/image/head.png"></asp:image></div>

       <div style="float:left;padding-top:13px"> <asp:Label runat="server" Text="小飞邮箱" CssClass="auto-style1" ForeColor="#0066FF"></asp:Label><br />

        <asp:Label runat="server" Text="mail.xf.com" CssClass="auto-style4" ForeColor="#0066FF"></asp:Label></div>

        <div style="float:left"><asp:Image runat="server" ID="userPhoto" Height="48px" Width="40px" ImageUrl="~/image/back.jpg"/></div>

        <div style="float:left;padding-top:15px"> <asp:Label runat="server" id="userid" Text="a1006817478(楚门)" Font-Size="15px"></asp:Label><br/>

            <asp:LinkButton runat="server" Text="个人中心" PostBackUrl="~/inforPage.aspx" Font-Size="13px"></asp:LinkButton>

        </div>

         <div style="float:right;padding-top:15px"> <asp:LinkButton runat="server" Text="关于" Font-Size="13px"></asp:LinkButton> | 

          <asp:LinkButton runat="server" Text="退出" Font-Size="13px" PostBackUrl="~/LoginPage.aspx"></asp:LinkButton>  

        </div>

        </div>

        <div style="float:left">

       <table width="960" border="0" style="padding-left:0px">

      <tr>

        <th width="160" height="600" align="center" valign="top" bgcolor="#6699FF" scope="col" style="background-color: #c5d8ff"><table width="150" height="280" border="0">

          <tr>

            <th width="150" style="text-align: left; height: 40px;" scope="col">

              <asp:LinkButton ID="LinkButton1" runat="server" Style="color: blue" PostBackUrl="~/SendPage.aspx" CausesValidation="False">写信</asp:LinkButton> </th>

          </tr>

          <tr>

            <th width="150" height="40" style="text-align: left" scope="row">

              <asp:LinkButton ID="LinkButton2" runat="server" style="color: blue" PostBackUrl="~/RecfPage.aspx" CausesValidation="False">收件箱</asp:LinkButton></th>

          </tr>

          <tr>

            <th width="150" height="40" style="text-align: left" scope="row">

              <asp:LinkButton ID="LinkButton7" runat="server" style="color: blue" PostBackUrl="~/ContactPage.aspx" CausesValidation="False">通信录</asp:LinkButton></th>

          </tr>

          <tr>

            <th width="150" height="40" style="text-align: left" scope="row">

              <asp:LinkButton ID="LinkButton3" runat="server" style="color: blue"  CausesValidation="False">发件箱</asp:LinkButton></th>

          </tr>

          <tr>

            <th width="150" style="text-align: left" scope="row" class="auto-style2">

              <asp:LinkButton ID="LinkButton4" runat="server" style="color: blue"  CausesValidation="False">草稿箱</asp:LinkButton></th>

          </tr>

          <tr>

            <th width="150" height="40" style="text-align: left" scope="row">

              <asp:LinkButton ID="LinkButton5" runat="server" style="color: blue"  CausesValidation="False">重要邮件</asp:LinkButton></th>

          </tr>

          <tr>

            <th width="150" style="text-align: left; height: 40px;" scope="row">

              <asp:LinkButton ID="LinkButton6" runat="server" style="color: blue" CausesValidation="False">垃圾箱</asp:LinkButton></th>

          </tr>

          

        </table></th>

        <th align="left" valign="top" scope="col">

            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

            </asp:ContentPlaceHolder>

        </th>

      </tr>

    </table> 

        </div>    

    </form>

</body>

</html>

 

 

C#

namespace email

{

    public partial class SiteMaster : MasterPage

    {

 

 

        protected void Page_Load(object sender, EventArgs e)

        {

            if (!IsPostBack)

            {

                String str = @"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\asus\Documents\Visual Studio 2015\Projects\email\email\App_Data\DB.mdf; Integrated Security = True";

                SqlConnection con = new SqlConnection(str);

                SqlCommand cmd = new SqlCommand("select * from userInfor where USERID=" + "'" + Session["userid"] + "'", con);

                SqlDataReader myReader = null;

                try

                {

                    con.Open();

                    myReader = cmd.ExecuteReader();

                    while (myReader.Read())

                    {

                        userid.Text = Session["userid"] + "<" + myReader[1] + ">";

                        if (myReader[6] != null)

                        {

                            userPhoto.ImageUrl = "~/UserPhotos/" + myReader[6];

                        }

                    }

 

                }

                catch

                {

 

                }

                finally

                {

                    if (myReader != null)

                    {

                        myReader.Close();

                    }

                    con.Close();

                }

 

            }

        }

    }

 

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值