Admin/liuyanManage.aspx.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class Admin_liuyanManage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
private void BindData()
{
string sql = "select * from liuyan order by ID desc";
DataSet ds = ClassDB.GetDataSet(sql);
DataGrid1.DataSource = ds.Tables[0];
DataGrid1.DataKeyField = "ID";
DataGrid1.DataBind();
}
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.DataGrid1.CurrentPageIndex = e.NewPageIndex;
BindData();
}
protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover", "c=this.style.backgroundColor,this.style.backgroundColor='#6699ff'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
}
}
protected void DataGrid1_DeleteCommand(object source, DataGridCommandEventArgs e)
{
int index = e.Item.ItemIndex;
string id = this.DataGrid1.DataKeys[index].ToString().Trim();
string sql;
sql = "delete from liuyan where ID=" + id + " ";
int result = ClassDB.Execute(sql);
if (result == 1)
{
Response.Write("<script>javascript:alert('删除成功');</script>");
BindData();
}
else
{
Response.Write("<script>javascript:alert('系统错误,请检查数据库设置问题');</script>");
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
