📄 viewcomment.aspx.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 BookShop;
public partial class ViewComment : System.Web.UI.Page
{
private int nCommentID = -1;
private int nCategoryID = -1;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["CategoryID"] != null)
{
nCategoryID = Int32.Parse(Request.Params["CategoryID"].ToString());
}
if (Request.Params["CommentID"] != null)
{
nCommentID = Int32.Parse(Request.Params["CommentID"].ToString());
}
if (!Page.IsPostBack)
{
if (nCommentID > -1)
{
///显示被修改书籍的数据
BindCommentData(nCommentID);
}
}
}
private void BindCommentData(int nCommentID)
{
///从数据库获取数据
Comment comment = new Comment();
SqlDataReader recc = comment.GetSingleComment(nCommentID);
///显示数据
if (recc.Read())
{
Desn.Text = recc["Desn"].ToString();
Body.Text = recc["Body"].ToString();
CreateDate.Text = recc["CreateDate"].ToString();
///设置评论所属的书籍
ASPNET2System.SetListBoxItem(BookList,recc["BookID"].ToString());
}
///关闭数据源
recc.Close();
}
protected void ReturnBtn_Click(object sender,EventArgs e)
{
///返回管理页面
Response.Redirect("~/DesktopModules/Book/CommentManage.aspx"
+ "?CategoryID=" + nCategoryID.ToString());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -