Demo/Projectlist.aspx.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Demo.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Demo
{
public partial class Projectlist : Page
{
protected void Page_Load(object sender, EventArgs e)
{
string LoginId = CookieHelper.GetCookie("Aid", "LoginId");
if(string.IsNullOrEmpty(LoginId))
{
Response.Write("<script>alert('请您先登录再操作!');window.location.href='Login.aspx';</script>");
Response.End();
}
if (!IsPostBack)
{
bind();
}
}
//绑定数据
public void bind()
{
DataTable data = DBHelper.GetDataTable($"select * from Project");
GridViewbook.DataSource = data.DataSet;
GridViewbook.DataBind();
}
protected void GridViewbook_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridViewbook.EditIndex = -1;//将gridview从编辑模式切换成浏览模式
bind();
}
protected void GridViewbook_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = Convert.ToInt32(this.GridViewbook.DataKeys[e.RowIndex].Value);
string str = "delete from Project where Pid=" + id;
int num = DBHelper.ExecuteNonQuery(str);
if (num > 0)
{
Response.Write("<script>alert('删除成功!')</script>");
}
else
{
Response.Write("<script>alert('删除失败!')</script>");
}
bind();
}
protected void GridViewbook_RowEditing(object sender, GridViewEditEventArgs e)
{
GridViewbook.EditIndex = e.NewEditIndex;
bind();
后面还有 46 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。