/// <summary> /// Checks whether there is a CurrentEntryID in the view state. /// If not, load default blog entry, otherwise load entry with the ID = CurrentEntryID. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void odsBlogEntry_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { if (ViewState["CurrentEntryID"] == null) { int BlogTopicId = new BlogTopicDAL().GetBlogTopicId(BlogTopic); BlogEntryDAL blogEntryDAL = new BlogEntryDAL(); int Id = blogEntryDAL.GetDefaultBlogEntryId(BlogTopicId); e.InputParameters["Id"] = Id; ViewState.Add("CurrentEntryID", e.InputParameters["Id"]); } else { e.InputParameters["Id"] = ViewState["CurrentEntryID"]; } }
/// <summary> /// Editing is done on the details screen /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, EventArgs e) { BlogTopicDAL blogTopicBLL = new BlogTopicDAL(); int blogTopicID = blogTopicBLL.GetBlogTopicId(BlogTopic); Response.Redirect(string.Format("/GUI/ProtectedSites/CreateBlogEntry.aspx?Id={0}&BlogTopicID={1}", CurrentEntryID, blogTopicID)); }