protected void btn_capnhat_Click(object sender, EventArgs e) { string path = Server.MapPath("~/admin/img/"); string id = Request.QueryString["id"]; string type_name = txtName.Text; int type_pos = Convert.ToInt32(txt_pos.Text); DateTime modified = DateTime.Parse(txt_Ngay.Text); int status = Convert.ToInt32(txt_status.Text); string username = txt_username.Text; string filename = FileUpload1.FileName; //if (filename != "") //{ // string path = Server.MapPath("~/admin/img/"); // FileUpload1.SaveAs(path + filename); //} //else //{ // filename = Image1.ImageUrl; //} FileUpload1.SaveAs(path + filename); FoodType food_type = new FoodType(type_name, type_pos, filename, status, username, modified); if (food_type.updateFood(Convert.ToInt32(id))) { ClientScript.RegisterStartupScript(this.GetType(), "key", "alertSuccess()", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "key", "alertError()", true); } }