protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; loadProvince(); loadRole(); if (id != null && id != "") { DataTable dt = acc.getUserById(id); if (dt.Rows.Count > 0) { if (dt.Rows[0]["uProvinceid"] != null && dt.Rows[0]["uProvinceid"].ToString() != "") { loadDistrict(int.Parse(dt.Rows[0]["uProvinceid"].ToString())); loadWard(int.Parse(dt.Rows[0]["uDistrictid"].ToString())); } txtUsername.Text = dt.Rows[0]["username"].ToString(); txtPassword.Text = dt.Rows[0]["password"].ToString(); txtFullname.Text = dt.Rows[0]["fullname"].ToString(); txtPhone.Text = dt.Rows[0]["phone"].ToString(); txtEmail.Text = dt.Rows[0]["email"].ToString(); DropDownList4.SelectedValue = dt.Rows[0]["roleId"].ToString(); DropDownList3.SelectedValue = dt.Rows[0]["uWardid"].ToString(); DropDownList2.SelectedValue = dt.Rows[0]["uDistrictid"].ToString(); DropDownList1.SelectedValue = dt.Rows[0]["uProvinceid"].ToString(); sImageUrl = "/Content/Image/Account/" + dt.Rows[0]["imageurl"].ToString(); datepicker.Text = dt.Rows[0]["birthdate"].ToString(); } else { Response.Write("<script>alert('Invalid ID !')</script>"); } } else { Response.Write("<script>alert('ID is empty !')</script>"); } } }