⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bbscontent.aspx.cs

📁 一个简单的网上书店形式
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using ASPNET2BBS;
using SQLHelper;

public partial class DesktopModules_BBS_BBSContent : System.Web.UI.Page
{
	int nTitleID = -1;

	protected void Page_Load(object sender, EventArgs e)
	{
		///获取参数的值
		if (Request.Params["TitleID"] != null)
		{
			nTitleID = Int32.Parse(Request.Params["TitleID"].ToString());
		}
		if (!Page.IsPostBack)
		{
			///绑定控件的数据
			if (nTitleID > -1)
			{
				BindContentData(nTitleID);
				UpdateVisitNum(nTitleID);
			}
		}
	}

	private void BindContentData(int nTitleID)
	{
		ASPNET2BBS.Content content = new ASPNET2BBS.Content();
		SqlDataReader recc = content.GetContentByTitle(nTitleID);	

		ContentList.DataSource = recc;
		ContentList.DataBind();

		recc.Close();
	}

	private void UpdateVisitNum(int nTitleID)
	{
		try
		{
			ASPNET2BBS.Title title = new Title();
			title.UpdateTitleVisitNum(nTitleID);
		}
		catch (Exception ex)
		{
			///显示操作中的失败、错误信息
			Response.Redirect("~/DesktopModules/ErrorPage.aspx?ErrorUrl="
				+ ASPNET2System.RedirectErrorUrl(Request.RawUrl)
				+ "&ErrorMessage=" + ex.Message.Replace("\n", " "));
		}
	}

	protected string FormatBody(string sBody)
	{
		return (sBody.Replace("\n", "<br>"));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -