protected void dlArticle_ItemDataBound(object sender, DataListItemEventArgs e) { _currArticle = e.Item.DataItem as Article; this.Title = "Liveandev: " + _currArticle.Title; lnkCat.Text = _currArticle.CategoryTitle; lnkCat.NavigateUrl = "~/BrowseArticles.aspx?ID=" + _currArticle.CategoryID; lblAricleNotExist.Visible = false; if (_currArticle.OnlyForMembers && !this.User.Identity.IsAuthenticated) { panWholeContent.Visible = false; lblOnlyForMembers.Visible = true; } else { lblOnlyForMembers.Visible = false; if (!_currArticle.Published && !this.User.IsInRole("Administrators")) { panWholeContent.Visible = false; lblNotPublished.Visible = true; } else { lblNotPublished.Visible = false; panWholeContent.Visible = true; if (!this.IsPostBack) _currArticle.IncrementViewCount(); lblInsertComment.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { _currArticle = null; } }