예제 #1
0
        public void BindNews()
        {
            string tmpId = Page.RouteData.Values["newsid"] as string;
            int    id    = 0;

            int.TryParse(tmpId, out id);

            New objNew = DomainManager.GetObject <New>(id);

            if (objNew != null)
            {
                litTitle.Text      = objNew.NewsTitle;
                litPostDate.Text   = objNew.CreatedDate.ToString(TNHelper.DateTimeFormat);
                litSummary.Text    = objNew.Summary;
                litNewContent.Text = objNew.NewsContent;

                imgPhoto.Visible = false;
                if (!string.IsNullOrEmpty(objNew.Photo))
                {
                    imgPhoto.ImageUrl = "/Userfiles/News/" + objNew.Photo;
                    imgPhoto.Visible  = true;
                }

                List <New> lst = TNHelper.GetRelateNew(DisplayRelateItem, objNew.CreatedDate);
                if (lst != null && lst.Count > 0)
                {
                    rptNews.DataSource = lst;
                    rptNews.DataBind();
                }
            }
        }