edituser.aspx.cs

(开头部分) 6KB

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

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;
public partial class edituser : System.Web.UI.Page
{
    SqlConnection cn;
    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Convert.ToString(Session["role"]) == "普通用户")
            {
                Response.Write("<script language='javascript'>alert('非常抱歉!您不是"管理员",不能进入该页面!^_^');window.location.href='Default.aspx'</script>");
            }
            this.databinduserinfo();
        }
    }
    public static string pagecount;
    private void databinduserinfo()
    {
        string admin = "普通用户";
        int countpage = Convert.ToInt32(this.Labelye.Text);
        cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
        cn.Open();
        SqlDataAdapter da = new SqlDataAdapter("select* from userinfo where role='" + admin + "' order by id desc", cn);
        da.Fill(ds, "Result");
        System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables["Result"].DefaultView;
        ps.AllowPaging = true;
        ps.PageSize = 12;
        ps.CurrentPageIndex = countpage - 1;
        this.lblPageCount.Text = Convert.ToString(ps.PageCount);

        this.Button2.Enabled = true;
        this.Button3.Enabled = true;

        if (countpage == 1)
        {
            this.Button2.Enabled = false;
        }
        if (countpage == ps.PageCount)
        {
            this.Button3.Enabled = false;
        }
        this.gvuserinfo.DataSource = ps;
        this.gvuserinfo.DataBind();
        if (this.gvuserinfo.Rows.Count == 0)
        {
            this.Panel1.Visible = false;
            this.Labmessage.Text = "温馨的提示:还没有会员,不能进行管理";
后面还有 144 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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