📄 admin_comment.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 BLL.System;
public partial class Admin_Admin_Comment : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindComment();
}
}
public void BindComment()
{
this.GridView1.DataSource = new CommentSystem().GetCommentList();
this.GridView1.DataBind();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
//获取所有;要删除的评论
foreach(GridViewRow row in this.GridView1.Rows)
{
if (((CheckBox)(row.FindControl("chkDelete"))).Checked)
{
//获取ID
int id = int.Parse(((Label)(row.FindControl("lblId"))).Text.ToString());
DeleComment(id);
}
}
BindComment();
}
//删除
private void DeleComment(int id)
{
CommentSystem com = new CommentSystem();
com.DeleteComment(id);
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
BindComment();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -