예제 #1
0
        protected void LoadData()
        {
            string strId = Page.RouteData.Values["id"] as string;
            int    id    = 0;

            int.TryParse(strId, out id);

            DM.Content content = TNHelper.GetContentObject(id);
            if (content != null)
            {
                litTitle.Text   = content.ContentTitle;
                litContent.Text = content.ContentText;

                if (content.ContentType != null)
                {
                    List <DM.Content> lst = TNHelper.GetContentsByType(content.ContentType.Id);
                    if (lst != null && lst.Count > 0)
                    {
                        lst = lst.Where(p => p.Active && p.Id < content.Id)
                              .OrderByDescending(p => p.Id)
                              .Take(10)
                              .ToList();
                    }

                    if (lst != null && lst.Count > 0)
                    {
                        rptList.DataSource = lst;
                        rptList.DataBind();
                    }
                }
            }
            else
            {
                Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu yêu cầu");
            }
        }