Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Users users = new Users();

            users.Users_Name1     = txtName1.Text.Trim();
            users.Users_Password1 = txtPassword1.Text.Trim();
            users.Users_Tel1      = txtTel1.Text.Trim();
            users.Users_Sex1      = RadioButtonList_sex.SelectedItem.Text;
            users.Users_Vip1      = int.Parse(RadioButtonList_vip.SelectedValue) == 1 ? true:false;
            users.Users_Admin1    = int.Parse(RadioButtonList_admin.SelectedValue) == 1 ? true : false;
            users.Users_Img1      = @"~/Img_Users/" + FileUpload1.PostedFile.FileName;
            try
            {
                if (UsersBll.update(users) == 1)
                {
                    BindView();
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('修改成功!');</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('修改失败!');</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("错误原因:" + ex.Message);
            }
        }