protected void cmdUpdate_Click(object sender, EventArgs e) { try { SEO_ToolController controller = new SEO_ToolController(); SEO_ToolInfo item = new SEO_ToolInfo(); item.Content = txtContent.Text; item.ItemId = itemId; item.ModuleId = this.ModuleId; item.CreatedByUser = this.UserId; //determine if we are adding or updating if (Null.IsNull(item.ItemId)) { controller.AddSEO_Tool(item); } else { controller.UpdateSEO_Tool(item); } Response.Redirect(Globals.NavigateURL(), true); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["ItemId"] != null) { itemId = Int32.Parse(Request.QueryString["ItemId"]); } if (!IsPostBack) { //load the data into the control the first time //we hit this page cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');"); //check we have an item to lookup if (!Null.IsNull(itemId)) { //load the item SEO_ToolController controller = new SEO_ToolController(); SEO_ToolInfo item = controller.GetSEO_Tool(this.ModuleId, itemId); if (item != null) { txtContent.Text = item.Content; ctlAudit.CreatedByUser = item.CreatedByUserName; ctlAudit.CreatedDate = item.CreatedDate.ToLongDateString(); } else { Response.Redirect(Globals.NavigateURL(), true); } } else { cmdDelete.Visible = false; ctlAudit.Visible = false; } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { GetSettings(); if (_QueryStringKey.ToString().Trim() != "") { MakeSEO(); } else { // lblTitle.Text = "Click settings to configure module."; lblPageTitle.Text = "Click settings to configure module."; } List <SEO_ToolInfo> items; SEO_ToolController controller = new SEO_ToolController(); items = controller.GetSEO_Tools(this.ModuleId); // items = controller.GetSEO_Tool(this.ModuleId, //check if we have some content to display, otherwise //display a sample default conent from the resource //settings if (items.Count == 0) { SEO_ToolInfo item = new SEO_ToolInfo(); item.ModuleId = this.ModuleId; item.CreatedByUser = this.UserId; item.Content = Localization.GetString("DefaultContent", LocalResourceFile); items.Add(item); } //bind the data lstContent.DataSource = items; lstContent.DataBind(); LiteralControl l = new LiteralControl(); foreach (SEO_ToolInfo sItem in items) { l.Text = Server.HtmlDecode(sItem.Content.ToString().Replace("[" + _QueryStringKey.ToString() + "]", _QueryStringKeyValue.ToString().Replace("_", " ").ToString()).ToString()); //l.Text.Replace l.Text = l.Text.ToString().Replace("[" + _QueryStringKey2.ToString() + "]", _QueryStringKey2Value.ToString().Replace("_", " ").ToString()).ToString(); l.Text = l.Text.ToString().Replace("[" + _QueryStringKey3.ToString() + "]", _QueryStringKey3Value.ToString().Replace("_", " ").ToString()).ToString(); //Code to add my liInUl to ul } PlaceHolder1.Controls.Add(l); } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }