using System; using System.ComponentModel; using System.Web.UI.WebControls; using SiberTek.Xenta.Presentation; using SiberTek.Xenta.Presentation.Presenters; using SiberTek.Xenta.Presentation.Views; using SiberTek.Xenta.Presentation.Resources; using SiberTek.Xenta.Utils; using SiberTek.Xenta.Web.Controls; using SiberTek.Xenta.Presentation.Utils; using SiberTek.Xenta.Enums; namespace SiberTek.Xenta.Web.Home.Modules { public partial class PublicationCommentForm : ViewBase<ForumPostPresenter>, IForm, ICommandHandler { #region Properties [Browsable(false)] public int TopicID { get { return Convert.ToInt32(ViewState["TopicID"]); } set { ViewState["TopicID"] = value; } } public string ValidationGroup { set { vldTitle.ValidationGroup = value; } } public bool Enabled { set { txtTitle.ReadOnly = !value; txtText.ReadOnly = !value; } } #endregion #region Methods public void Reset() { txtTitle.Text = String.Empty; txtText.Text = String.Empty; } #endregion #region Handlers protected override void OnInit(EventArgs e) { if(!IsPostBack) { lblTitle.Text = StringManager.GetString("Home.PublicationCommentForm.lblTitle.Text"); lblText.Text = StringManager.GetString("Home.PublicationCommentForm.lblText.Text"); } base.OnInit(e); } public void OnCommand(object sender, CommandEventArgs e) { switch(e.CommandName) { case "Create": { try { ViewDataContainer item = new ViewDataContainer(); item["ParentPostID"] = 0; item["TopicID"] = TopicID; item["AuthorID"] = UserContext.Current.UserID; item["Title"] = StringHelper.EncodeHtml(txtTitle.Text); item["Text"] = StringHelper.EncodeHtml(txtText.Text); item["IsActive"] = true; DataContainer["ForumPost"] = item; Presenter.Create(); } catch(Exception ex) { Page.ShowMessage(ex.Message); } } break; } } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The MIT License