protected void Btn_update_Click(object sender, EventArgs e) { FoodType ft = new FoodType(); if (ft.Type_id == 0) { ft.Type_id = Convert.ToInt32(hfTypeID.Value); ft.Type_name = txtName.Text; ft.Type_post = Convert.ToInt32(txtPost.Text); int lastIndex = hfImgReview.Value.LastIndexOf("/"); ft.Type_img = hfImgReview.Value.Substring(lastIndex + 1).ToString(); ft.Status = Convert.ToInt32(ddlStatus.SelectedValue); ft.Username = "******"; if (ft.update()) { lblMessage.Text = "Cập Nhật Thành Công"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "showModal();", true); Btn_cancel_Click(sender, e); } else { Response.Write("<script>alert('Thất Bại') </script>"); } } }