显示列表list.aspx
<%@ page 
language="c#" codebehind="list.cs" autoeventwireup="false" 
inherits="notpage.list" %>
<html><head>
<meta 
name="generator" content="microsoft visual studio 7.0">
<meta 
name="code_language" content="c#"></head>
<body>
<form method="post" runat="server"></p><p> 
</form><a href = 
"addtopic.aspx">发表留言</a><br>
<table width="90%" height="1" 
border="0" cellspacing="2" cellpadding="2" 
id=liuyan>
<tr>
<td>主题</td>
<td>留言人</td>
<td>留言时间</td>
</tr>
<asp:label id="n_tdtitle" runat=server></asp:label>
</table></p><p> </body></html>
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;</p><p> </p><p>
/// 
<summary>
/// summary description 
for list.
/// </summary>
public class list : 
system.web.ui.page
{
protected 
system.web.ui.webcontrols.label n_tdtitle;
public list()
{
page.init += new 
system.eventhandler(page_init);
}</p><p> protected void 
page_load(object sender, eventargs e)
{
if (!ispostback)
{
//
// 
evals true first time browser hits the page
//
}
}</p><p> 
protected void page_init(object sender, eventargs e)
{
//
// codegen: 
this call is required by the asp+ windows form 
designer.
//
initializecomponent();
init_tdtitle();
</p><p> 
}
</p><p> /// <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);
}
protected void init_tdtitle()
{
initializecomponent();
//
// 
codegen: this call is required by the asp+ windows form 
designer.
//
try
{ 
notepage np = new notepage();</p><p> 
arraylist arrtopic = np.gettopiclist();
for ( int i = 0 ; i < arrtopic.count ; i ++)
{ 
notepage objtopic = 
(notepage)arrtopic[i] ;
string str ="<tr><td><a href = 
showtopic.aspx?id="+objtopic.id.tostring()+"> + objtopic.title.tostring() + 
</a></td>;
str = str +<td> + 
objtopic.author.tostring()+</td>;
str = str +<td> + 
objtopic.adddate.tostring()+</td></tr>;
n_tdtitle.text = str + 
n_tdtitle.text;
}
}
catch(exception e)
{
throw(new 
exception(取得贴子列表出错: + e.tostring())) ;
}</p><p> 
}
}
}
 以上就是利用c#制作简单的留言板(3)的内容。
   
 
   