admin/web/Links.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using 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_web_Links : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["curAdmin"] == null || Session["curAdmin"].ToString() == null)
        {
            Response.Redirect("../Login.aspx");
            Response.End();
        }
        if (!IsPostBack)
        {
            ListBind();
        }

    }
    #region 绑定分页函数
    /// <summary>
    /// 显示当前分页信息
    /// </summary>
    private void ListBind()
    {
        string strSql = "select * from KY_Links";
        DataTable dt = KYSql.ExecuteQuery(strSql);
        this.AspNetPager1.RecordCount = dt.Rows.Count;
        PagedDataSource pds = new PagedDataSource();
        pds.AllowPaging = true;
        pds.PageSize = AspNetPager1.PageSize;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        pds.DataSource = dt.DefaultView;
        this.GridView1.DataSource = pds;
        this.GridView1.DataBind();
    }
    #endregion
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int id = Convert.ToInt32(e.CommandArgument);
        if (e.CommandName == "del")
        {
            string DelSql = "delete from KY_Links where id='" + id + "'";
            if (KYSql.ExecuteNonQuery(DelSql) > 0)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "sd", "<script>alert('恭喜你,删除成功!')</script>");
                Response.Redirect("Links.aspx");
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "sd", "<script>alert('抱歉,删除失败!')</script>");
                Response.Redirect("Links.aspx");
            }
        }
        else if (e.CommandName == "isUse")
        {
后面还有 16 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。