コード例 #1
0
ファイル: NewsEdit.ascx.cs プロジェクト: wefasdfaew2/tngames
        private void LoadEditData()
        {
            string strId = Page.RouteData.Values["id"] as string;
            int    id    = 0;

            int.TryParse(strId, out id);

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

            if (obj != null)
            {
                txtTitle.Text   = obj.NewsTitle;
                txtAlias.Text   = obj.NewsAlias;
                txtSummary.Text = obj.Summary;
                txtContent.Text = obj.NewsContent;

                if (obj.Category != null)
                {
                    ListItem item = ddlCategories.Items.FindByValue(obj.Category.Id.ToString());
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }

                if (!string.IsNullOrEmpty(obj.Photo))
                {
                    imgPhoto.ImageUrl = TNHelper.GetNewsPhoto(obj.Photo);
                    imgPhoto.Visible  = true;
                }
                btnDelete.Visible = true;
            }
            else
            {
                imgPhoto.Visible  = false;
                btnDelete.Visible = false;
            }
        }