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; namespace Web.Admin 

    public partial class editAdmin : System.Web.UI.Page 
    { 
        public int PK_ID = 0;  //公共变量 PK_ID = 0 
        public int FK_ID = 0;   //公共变量 FK_ID = 0 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (Session["adminLogin"] == null) //判断session是否等于空
            { 
                Response.Redirect("Login.aspx");  // 是空的话! 跳转登陆页 
            } 
            if (Request.QueryString["PK_ID"] != null && BLL.UserUtil.IsNumeric(Request.QueryString["PK_ID"].ToString())) //判断PK_ID 不为NULL 不为空
            { 
                PK_ID = Convert.ToInt32(Request.QueryString["PK_ID"]);   // 赋值PK_ID 
            } 
            else 
            { 
                Response.Write(" <script>alert('参数错误');window.location='admin.aspx'; </script>");  //错误提示
            } 
            if (Request.QueryString["FK_ID"] != null && BLL.UserUtil.IsNumeric(Request.QueryString["FK_ID"].ToString())) FK_ID不为NULL 不为空            { 
                FK_ID = Convert.ToInt32(Request.QueryString["FK_ID"]);  // 赋值PK_ID             } 
            else 
            { 
                Response.Write(" <script>alert('参数错误');window.location='admin.aspx'; </script>"); //错误提示            }             BLL.Admin bll = new BLL.Admin(); 
            Model.Admin model= bll.GetModel(PK_ID);  //GetModel 方法里面传入 PK_ID  返回 实体model
            if (!this.IsPostBack) 
            { 
                TextBox1.Attributes.Add("value", Convert.ToString(model.SPwd)); //给控件添加 VALUE  的值
                TextBox2.Attributes.Add("value", Convert.ToString(model.SPwd)); //给控件添加 VALUE  的值
            } 
        }         protected void Button1_Click(object sender, EventArgs e)   //按钮事件
        { 
            Model.Admin model = new Model.Admin(); 
            model.SPwd = BLL.Admin.MD5(TextBox2.Text);    密码MD5加密
            model.FK_ID = FK_ID;                    model.PK_ID = PK_ID;             BLL.Admin bll = new BLL.Admin(); 
            bll.Update(model);  //更新MODEL 数据
            Response.Write(" <script>alert('成功');window.location='admin.aspx?FK_ID="+FK_ID+"'; </script>"); //成功提示
        } 
    } 

// 上面应该是个修改密码的页面吧?