forumview.aspx.cs
来自「asp做的新闻系统」· CS 代码 · 共 120 行
CS
120 行
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace Web.Admin
{
/// <summary>
/// ForumView 的摘要说明。
/// </summary>
public class ForumView : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlTable Table4;
protected System.Web.UI.HtmlControls.HtmlTable Table1;
public Web.DataAccess.DataAccess Das = new DataAccess.DataAccess();
public string m_strTitle,m_strContent,m_strUserName,m_strPostDate,strForumName;
public int nForumID,nBoardID;
private void Page_Load(object sender, System.EventArgs e)
{
string strSql;
Session["UserName"] = "beyond";
nBoardID = int.Parse(Request["BoardID"].ToString());
strSql = "select ForumID,title,content,username,postdate from forum where boardid=" + nBoardID;
OleDbDataReader read = Das.GetDataReader(strSql);
if(read.Read())
{
nForumID = int.Parse(read[0].ToString());
switch(nForumID)
{
case 1:
strForumName = "ASP.NET技术专题";
break;
case 2:
strForumName = "C#.NET技术专题";
break;
case 3:
strForumName = "VB.NET技术专题";
break;
case 4:
strForumName = "VC++.NET技术专题";
break;
case 5:
strForumName = "DOTNET书籍专区";
break;
}
m_strTitle = read[1].ToString();
m_strContent = read[2].ToString();
m_strUserName = read[3].ToString();
m_strPostDate = read[4].ToString();
}
read.Close();
}
public void Reply()
{
string strTitle,strContent,strUserName,strPostDate,strSql;
strSql = "select title,content,username,postdate from forum where replyboardid=" + nBoardID;
OleDbDataReader read = Das.GetDataReader(strSql);
while(read.Read())
{
strTitle = read[0].ToString();
strContent = read[1].ToString();
strUserName = read[2].ToString();
strPostDate = read[3].ToString();
Response.Write("<TR>");
Response.Write("<TD height='150' align='left' width='155' vAlign='top'>作者:" + strUserName);
Response.Write("<br>发表时间:" + strPostDate);
Response.Write("</TD>");
Response.Write("<TD colSpan='3'>");
Response.Write("<TABLE id='Table2' style='BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; BORDER-COLLAPSE: collapse' borderColor='#dddddd' height='100%' cellSpacing='0' cellPadding='0' width='100%' align='center' bgColor='whitesmoke' borderColorLight='#dddddd' border='1' runat='server'>");
Response.Write("<TR>");
Response.Write("<TD align='right' width='80' vAlign='top'>回复:");
Response.Write("</TD>");
Response.Write("<TD colSpan='3' vAlign='top'>" + strContent);
Response.Write("</TD>");
Response.Write("</TR>");
Response.Write("</TABLE>");
Response.Write("</FONT>");
Response.Write("</TD>");
Response.Write("</TR>");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?