protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditNews") { News objData = new News(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); CurrentNews = objData; uiTextBoxArTitle.Text = objData.Title; uiTextBoxCommitee.Text = objData.CommiteeName; uiFCKeditorContent.Value = Server.HtmlDecode(objData.Details); uiTextBoxBrief.Text = objData.Brief; uiPanelViewAllPages.Visible = false; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteNews") { News objData = new News(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); BindData(); } }
protected void uiLinkButtonUpdate_Click(object sender, EventArgs e) { News objData = new News(); if (CurrentNews != null) objData = CurrentNews; else { objData.AddNew(); } objData.Title = uiTextBoxArTitle.Text; objData.CommiteeName = uiTextBoxCommitee.Text; objData.Details = Server.HtmlEncode(uiFCKeditorContent.Value); objData.Brief = uiTextBoxBrief.Text; objData.NewsDate = DateTime.Now; objData.Save(); CurrentNews = null; uiPanelViewAllPages.Visible = true; uiPanelEdit.Visible = false; BindData(); }