Beispiel #1
0
 protected void lnkButton_Command(object sender, CommandEventArgs e)
 {
     BlogEntryDAL blogEntryDAL = new BlogEntryDAL();
     int Id = Convert.ToInt32(e.CommandArgument);
     BlogEntry blogEntry = blogEntryDAL.GetBlogEntry(Id);
     Response.Redirect(string.Format("/GUI/{0}?BlogEntryID={1}", blogEntry.BlogCategory.BlogTopic.PageName, blogEntry.Id));
 }
Beispiel #2
0
 /// <summary>
 /// Occurs when user presses the links in the archive
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Archive_LinkButtonPressed(object sender, CommandEventArgs e)
 {
     int Id = Convert.ToInt32(e.CommandArgument);
     BlogEntryDAL blogEntryDAL = new BlogEntryDAL();
     BlogEntry blogEntry = blogEntryDAL.GetBlogEntry(Id);
     if (blogEntry != null)
     {
         string pageName = blogEntry.BlogCategory.BlogTopic.PageName;
         Response.Redirect(string.Format("/GUI/{0}?BlogEntryID={1}", pageName, Id));
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            MembershipUser user = Membership.GetUser();
            if (user != null && user.UserName.ToLower() == "administrator" && user.IsOnline)
            {
                this.btnEdit.Visible = true;
            }
            else
            {
                this.btnEdit.Visible = false;
            }

            this.lblShowPopup.Visible = IsCommentsVisible;
            this.ModalPopupExtender1.Enabled = IsCommentsVisible;
            this.Popup.Visible = IsCommentsVisible;

            this.dvwEntry.Fields[1].Visible = IsPublishedDateVisible;

            BlogEntryDAL blogEntryDAL = new BlogEntryDAL();
            BlogEntry blogEntry;
            if (!IsPostBack)
            {
                int BlogEntryId = Convert.ToInt32(Request.Params["BlogEntryID"]);

                //if there is a request param, take it, otherwise get the default entry
                if (BlogEntryId != 0)
                {
                    blogEntry = blogEntryDAL.GetBlogEntry(BlogEntryId);
                }
                else
                {
                    blogEntry = blogEntryDAL.GetDefaultBlogEntry(BlogTopic);
                }

                //save the id of the blogEntry (if it exists) to the view state, in order that it is selected in the ods selecting event
                if (blogEntry != null)
                {
                    CurrentEntryID = blogEntry.Id.ToString();
                }
            }

            this.dvwBlogComment.ChangeMode(DetailsViewMode.Insert);
        }