protected void uiGridViewBlocks_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditBlock") { int id = Convert.ToInt32(e.CommandArgument.ToString()); CurrentBlock = id; DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetBlockContent(id); if (ds.Tables[0].Rows.Count > 0) { uiTextBoxTitle.Text = ds.Tables[0].Rows[0]["Title"].ToString(); uiFCKeditor.Value = Server.HtmlDecode(ds.Tables[0].Rows[0]["Brief"].ToString()); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Imagepath"].ToString())) { uiImageCurrent.ImageUrl = ds.Tables[0].Rows[0]["Imagepath"].ToString(); uiImageCurrent.Visible = true; } else { uiImageCurrent.Visible = false; } } uiPanelCurrentBlocks.Visible = false; uiPanelCurrent.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBLayer db = new DBLayer(); DataSet ds = new DataSet(); ds = db.GetBlockContent(2); uiLiteralTitle.Text = ds.Tables[0].Rows[0]["arTitle"].ToString(); uiLiteralContent.Text = Server.HtmlDecode(ds.Tables[0].Rows[0]["arBrief"].ToString()); uiImageBlock.ImageUrl = ds.Tables[0].Rows[0]["arImagePath"].ToString(); } }
protected void uiLinkButtonUpdate_Click(object sender, EventArgs e) { DBLayer db = new DBLayer(); string imagepath = ""; if (uiFileUploadImage.HasFile) { uiFileUploadImage.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["UserFilePath"] + "UploadedImages/" + uiFileUploadImage.FileName)); imagepath = ConfigurationManager.AppSettings["UserFilePath"] + "UploadedImages/" + uiFileUploadImage.FileName; } DataSet ds = new DataSet(); ds = db.GetBlockContent(CurrentBlock); string temp = ds.Tables[0].Rows[0]["Imagepath"].ToString(); if (temp != imagepath && string.IsNullOrEmpty(imagepath)) db.SetEnglishBlockContent(CurrentBlock, Server.HtmlEncode(uiFCKeditor.Value), uiTextBoxTitle.Text, temp); else db.SetEnglishBlockContent(CurrentBlock, Server.HtmlEncode(uiFCKeditor.Value), uiTextBoxTitle.Text, imagepath); uiTextBoxTitle.Text = ""; uiFCKeditor.Value = ""; CurrentBlock = 0; uiPanelCurrentBlocks.Visible = true; uiPanelCurrent.Visible = false; }