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

查看留言内容showtopic.aspx

1@ Page language="c#" Codebehind="showTopic.cs" AutoEventWireup="false" Inherits="notpage.showTopic" 
 1<html><head>
 2<meta content="Microsoft Visual Studio 7.0" name="GENERATOR"/>
 3<meta content="C#" name="CODE_LANGUAGE"/></head>
 4<body>
 5<form method="post" runat="server">
 6<p align="center"><font color="red"><b>察看留言</b></font></p><br/>
 7<p align="left"><font color="blue">留言主题:<asp:label forecolor="Black" id="n_tdtitle" runat="Server"></asp:label>
 8<br/>留言时间:<asp:label forecolor="Black" id="n_tdAdddate" runat="Server"></asp:label><br/></font><font color="blue">留言人:   
 9<asp:label forecolor="Black" id="n_tdAuthor" runat="server"></asp:label><br/>留言内容:<asp:label forecolor="Black" id="n_tdContent" runat="Server"></asp:label> </font></p></form>
10</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;

 1<p> /// <summary>   
 2/// Summary description for showTopic.   
 3/// </summary>   
 4public class showTopic : System.Web.UI.Page   
 5{   
 6protected System.Web.UI.WebControls.Label n_tdAuthor;   
 7protected System.Web.UI.WebControls.Label td;   
 8protected System.Web.UI.WebControls.Label n_tdContent;   
 9protected System.Web.UI.WebControls.Label n_tdAdddate;   
10protected System.Web.UI.WebControls.Label n_tdtitle;   
11protected System.Web.UI.WebControls.Label n_ttitle;   
12  
13public showTopic()   
14{   
15Page.Init += new System.EventHandler(Page_Init);   
16}</p>
1<p> protected void Page_Load(object sender, EventArgs e)   
2{   
3if (!IsPostBack)   
4{   
5//   
6// Evals true first time browser hits the page   
7//   
8}   
9}</p>
 1<p> protected void Page_Init(object sender, EventArgs e)   
 2{   
 3//   
 4// CODEGEN: This call is required by the ASP+ Windows Form Designer.   
 5//   
 6int int_ID;   
 7int_ID = Request.QueryString["ID"].ToInt32();   
 8notepage np = new notepage();   
 9notepage objNp = np.GetTopic(int_ID);   
10n_tdtitle.Text = objNp.Title.ToString();   
11n_tdContent.Text = objNp.Content.ToString();   
12n_tdAuthor.Text = objNp.Author.ToString();   
13n_tdAdddate.Text = objNp.adddate.ToString();   
14InitializeComponent();   
15}</p>
 1<p> /// <summary>   
 2/// Required method for Designer support - do not modify   
 3/// the contents of this method with the code editor.   
 4/// </summary>   
 5private void InitializeComponent()   
 6{   
 7this.Load += new System.EventHandler (this.Page_Load);   
 8}   
 9}   
10}</p>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus