protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["NID"] != null && !string.IsNullOrEmpty(Request.QueryString["NID"])) { uiPanelAllNews.Visible = false; uiPanelViewNews.Visible = true; int id = Convert.ToInt32(Request.QueryString["NID"].ToString()); BLL.News currentnews = new BLL.News(); currentnews.LoadByPrimaryKey(id); uiLabelDate.Text = string.Format("{0:yyyy-MM-dd}", currentnews.CreatedDate.ToString()); uiLabelTime.Text = string.Format("{0:hh:mm:ss}", currentnews.CreatedDate.ToString()); uiLabelTitle.Text = currentnews.EnTitle; if (!string.IsNullOrEmpty(currentnews.MainPicturePath)) uiImageNews.ImageUrl = currentnews.MainPicturePath; else uiImageNews.ImageUrl = "images/logo_Big_watermark.jpg"; uiLiteralContent.Text = Server.HtmlDecode(currentnews.EnBody); } else { uiPanelAllNews.Visible = true; uiPanelViewNews.Visible = false; BindData(); } } }
protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditNews") { BLL.News objData = new BLL.News(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); CurrentNews = objData; uiTextBoxArTitle.Text = objData.ArTitle; uiTextBoxEnTitle.Text = objData.EnTitle; uiFCKeditorArBody.Value = Server.HtmlDecode(objData.ArBody); uiFCKeditorEnBody.Value = Server.HtmlDecode(objData.EnBody); //uiDropDownListCategory.SelectedValue = objData.CategoryID.ToString(); uiTextBoxEnBreif.Text = objData.EnBrief; uiTextBoxArBrief.Text = objData.ArBrief; //uiTextBoxDate.Text = ds.Tables[0].Rows[0]["CreatedDate"].ToString(); uiPanelViewNews.Visible = false; uiPanelEdit.Visible = true; uiPanelExport.Visible = false; } else if (e.CommandName == "DeleteNews") { BLL.News objData = new BLL.News(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentNews = null; BindData(); } }