protected void Save_Click(object sender, EventArgs e) { CustomProfile _profile = (CustomProfile)HttpContext.Current.Profile; ForumTopics _forum = new ForumTopics(this.ConnectionString); _forum.Title = HttpUtility.HtmlEncode(txt_Title.Text); _forum.Topic = HttpUtility.HtmlEncode(txt_Topic.Text); _forum.Status = Convert.ToInt32(Enums.enumStatuses.Active); _forum.CultureInfo = _profile.Culture; if (_forum.Save()) { Response.Redirect("viewtopic.aspx?topic=" + _forum.ID.ToString()); } else { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('An unexpected error has occurred. Please try again.');", true); } }
protected void PostComment_Click(Object sender, EventArgs e) { String _id = ViewState["topic"].ToString(); CustomProfile _profile = (CustomProfile)HttpContext.Current.Profile; ForumTopics _newTopic = new ForumTopics(this.ConnectionString); _newTopic.Topic = txt_Topic.Text; _newTopic.ParentId = Convert.ToInt32(_id); _newTopic.Status = Convert.ToInt32(Enums.enumStatuses.Active); _newTopic.CultureInfo = _profile.Culture; if (_newTopic.Save()) { pnl_Threads.Visible = true; pnl_PostForm.Visible = false; span_Post.Visible = true; txt_Topic.Text = ""; ForumTopics _topic = new ForumTopics(this.ConnectionString); _topic.LitePopulate(_id, true); BindData(_topic); } else { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", "alert('An unexpected error has occurred. Please try again.');", true); } }