protected void Page_Load(object sender, EventArgs e) { // Lấy tham số string ID = Request.QueryString["ID"].ToString(); // Gán Mode: mã để trống-thêm mới, có mã-Chỉnh sửa if (ID == "") { M_Mode.Mode = Modes.INSERT; } else { M_Mode.Mode = Modes.EDIT; } if (!IsPostBack) { // Khởi tạo control this.txtIntroID.Enabled = false; // Lấy giá trị ban đầu if (M_Mode.Mode == Modes.EDIT) { this.Page.Title = "Cập nhập nội dung giới thiệu"; this.lbModeMessage.Text = "Cập nhập nội dung giới thiệu"; // Gán ID this.txtIntroID.Text = ID; // Lấy giá trị cho các control AboutUs _obj = new AboutUs(); _obj.IntroID = Convert.ToInt32(this.txtIntroID.Text); _obj = AboutUs.GetByID(_obj); this.ckeDescription.Text = _obj.Description; this.chkActive.Checked = _obj.Active; } else if (M_Mode.Mode == Modes.INSERT) { this.Page.Title = "Thêm mới nội dung giới thiệu"; this.lbModeMessage.Text = "Thêm mới nội dung giới thiệu"; this.ckeDescription.Text = ""; } } }