protected void Page_Load(object sender, EventArgs e) { Context.Items["strTitle"] = "DANH SÁCH TIN TỨC, BÀI VIẾT"; if (!Page.IsPostBack) { DataNewsGroup objGroup = new DataNewsGroup(); ddlGroup.DataSource = objGroup.getDataToCombobox("Tất cả"); ddlGroup.DataValueField = "ID"; ddlGroup.DataTextField = "NAME"; ddlGroup.DataBind(); ddlGroup.SelectedValue = "0"; } }
protected void Page_Load(object sender, EventArgs e) { try { this.itemId = int.Parse(Request["id"].ToString()); } catch { } if (!Page.IsPostBack) { DataNewsGroup objGroup = new DataNewsGroup(); ddlGroup.DataSource = objGroup.getDataToCombobox(""); ddlGroup.DataValueField = "ID"; ddlGroup.DataTextField = "NAME"; ddlGroup.DataBind(); } if (!Page.IsPostBack && this.itemId != 0) { DataRow objData = objNews.getData(this.itemId); if (objData == null) { objSystemClass.addMessage("Bạn cần chọn nhóm để sửa."); Response.Redirect("NewsList.aspx"); return; } txtTitle.Text = objData["Title"].ToString(); ddlGroup.SelectedValue = objData["CatId"].ToString(); txtShortContent.Text = objData["ShortContent"].ToString(); txtContent.Text = objData["Content"].ToString(); txtAuthor.Text = objData["Author"].ToString(); ckbNoiBat.Checked = (bool)objData["NoiBat"]; txtTag.Text = objData["tag"].ToString(); if (objData["ImgUrl"] != null && objData["ImgUrl"].ToString() != "") { htxtimg.Value = "/Images/News/" + objData["ImgUrl"].ToString(); } } }