protected void Page_Load(object sender, EventArgs e) { int channel = Convert.ToInt32(Request.QueryString["id"]); NavigationControl nav = new NavigationControl(); sidebar.InnerHtml = nav.GetHtml(channel); var record = ChannelManager.GetDbRecord(channel); int displayMode = record.display_mode; if (displayMode == ChannelDisplayMode.MainContent) { int mainContent = ChannelManager.GetContentList(channel).First().id; ContentPresenter cp = new ContentPresenter(mainContent); content.InnerHtml = cp.GetHtml(); } else if (displayMode == ChannelDisplayMode.ContentList) { ContentListControl list = new ContentListControl(); content.InnerHtml = list.GetHtml(channel, -1, true); } else if (displayMode == ChannelDisplayMode.LoadPage) { ClientScript.RegisterStartupScript(this.GetType(), "loadPage", string.Format("<script>loadPage('{0}');</script>", record.link)); } else if (displayMode == ChannelDisplayMode.Hyperlink) { Response.Redirect(record.link); } }
protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt32(Request.QueryString["id"]); int channel = ContentManager.GetDbRecord(id).fk_channel_id; NavigationControl nav = new NavigationControl(); sidebar.InnerHtml = nav.GetHtml(channel); ContentPresenter cp = new ContentPresenter(id); content.InnerHtml = cp.GetHtml(); content.InnerHtml += "<p> </p>"; // 附件 if (ContentManager.GetAttachments(id).Count() > 0) { AttachmentPresenter ap = new AttachmentPresenter(id); TongJi.Web.Controls.HtmlDivision div = new TongJi.Web.Controls.HtmlDivision(); div.InnerHtml = ap.GetHtml(); content.Controls.Add(div); content.Controls.Add(new TongJi.Web.Controls.HtmlParagraph()); } // 评论 if (ContentManager.GetDbRecord(id).allow_comment) { if (ContentManager.GetComments(id).Count() > 0) { CommentPresenter presenter = new CommentPresenter(id); TongJi.Web.Controls.HtmlDivision div = new TongJi.Web.Controls.HtmlDivision(); div.InnerHtml = presenter.GetHtml(); content.Controls.Add(div); } CommentPoster poster = new CommentPoster(id); content.Controls.Add(poster.GetControl()); poster.Post += new EventHandler(poster_Post); } }