/BlogEngine/BlogEngine.NET/widgets/RecentComments/edit.ascx.cs
C# | 58 lines | 31 code | 10 blank | 17 comment | 1 complexity | 7b24aa6d1eae74a531f052a4b952ecd2 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
- // --------------------------------------------------------------------------------------------------------------------
- // <summary>
- // The edit.
- // </summary>
- // --------------------------------------------------------------------------------------------------------------------
-
- namespace Widgets.RecentComments
- {
- using System;
- using System.Web;
-
- using App_Code.Controls;
- using BlogEngine.Core;
-
- /// <summary>
- /// The edit.
- /// </summary>
- public partial class Edit : WidgetEditBase
- {
- #region Public Methods
-
- /// <summary>
- /// Saves this the basic widget settings such as the Title.
- /// </summary>
- public override void Save()
- {
- var settings = this.GetSettings();
- settings["numberofcomments"] = this.txtNumberOfPosts.Text;
- this.SaveSettings(settings);
- Blog.CurrentInstance.Cache.Remove("widget_recentcomments");
- }
-
- #endregion
-
- #region Methods
-
- /// <summary>
- /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
- /// </summary>
- /// <param name="e">
- /// An <see cref="T:System.EventArgs"/> object that contains the event data.
- /// </param>
- protected override void OnPreRender(EventArgs e)
- {
- base.OnPreRender(e);
-
- if (this.Page.IsPostBack)
- {
- return;
- }
-
- var settings = this.GetSettings();
- this.txtNumberOfPosts.Text = settings.ContainsKey("numberofcomments") ? settings["numberofcomments"] : "10";
- }
-
- #endregion
- }
- }