首页 > 开发 > 综合 > 正文

利用c#制作简单的留言板 (4)

2024-07-21 02:20:21
字体:
来源:转载
供稿:网友
查看留言内容showtopic.aspx
<%@ page language="c#" codebehind="showtopic.cs" autoeventwireup="false" inherits="notpage.showtopic" %>
<html><head>
<meta content="microsoft visual studio 7.0" name=generator>
<meta content=c# name=code_language></head>
<body>
<form method=post runat="server">
<p align=center><font color=red><b>察看留言</b></font></p><br>
<p align=left><font color=blue>留言主题:<asp:label id=n_tdtitle runat="server" forecolor="black"></asp:label>
<br>留言时间:<asp:label id=n_tdadddate runat="server" forecolor="black"></asp:label><br></font><font color=blue>留言人:
<asp:label
id=n_tdauthor runat="server" forecolor="black"></asp:label><br>留言内容:<asp:label id=n_tdcontent
runat="server" forecolor="black"></asp:label> </font></p></form>
    
  </body></html>
对应的cs
namespace notpage
{
    using system;
    using system.collections;
    using system.componentmodel;
    using system.data;
    using system.drawing;
    using system.web;
    using system.web.sessionstate;
    using system.web.ui;
    using system.web.ui.webcontrols;
    using system.web.ui.htmlcontrols;

    /// <summary>
    ///    summary description for showtopic.
    /// </summary>
    public class showtopic : system.web.ui.page
    {
        protected system.web.ui.webcontrols.label n_tdauthor;
        protected system.web.ui.webcontrols.label td;
        protected system.web.ui.webcontrols.label n_tdcontent;
        protected system.web.ui.webcontrols.label n_tdadddate;
        protected system.web.ui.webcontrols.label n_tdtitle;
        protected system.web.ui.webcontrols.label n_ttitle;
    
    public showtopic()
    {
        page.init += new system.eventhandler(page_init);
        }

        protected void page_load(object sender, eventargs e)
        {
            if (!ispostback)
            {
                //
                // evals true first time browser hits the page
                //
            }
        }

        protected void page_init(object sender, eventargs e)
        {
            //
            // codegen: this call is required by the asp+ windows form designer.
            //
            int int_id;
            int_id = request.querystring["id"].toint32();
            notepage np = new notepage();
            notepage objnp = np.gettopic(int_id);
            n_tdtitle.text = objnp.title.tostring();
            n_tdcontent.text = objnp.content.tostring();
            n_tdauthor.text = objnp.author.tostring();
            n_tdadddate.text = objnp.adddate.tostring();
            initializecomponent();
        }

        /// <summary>
        ///    required method for designer support - do not modify
        ///    the contents of this method with the code editor.
        /// </summary>
        private void initializecomponent()
        {
            this.load += new system.eventhandler (this.page_load);
        }
    }
}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表