private void LoadData() { BannerController banner_obj = new BannerController(); DataTable dt = banner_obj.GetDetailById(_idx); txtTitle.Text = dt.Rows[0]["Title"].ToString(); txtDescription.Text = dt.Rows[0]["Description"].ToString(); txtTags.Text = dt.Rows[0]["Tags"].ToString(); txtWidth.Text = dt.Rows[0]["Width"].ToString(); txtHeight.Text = dt.Rows[0]["Height"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["StartDate"].ToString())) { DateTime _StartDate = Convert.ToDateTime(dt.Rows[0]["StartDate"].ToString()); txtStartDate.Text = _StartDate.ToString("dd/MM/yyyy"); } if (!string.IsNullOrEmpty(dt.Rows[0]["EndDate"].ToString())) { DateTime _EndDate = Convert.ToDateTime(dt.Rows[0]["StartDate"].ToString()); txtEndDate.Text = _EndDate.ToString("dd/MM/yyyy"); } string Status = dt.Rows[0]["Status"].ToString(); if (Status == "1") { ChkBoxStatus.Checked = true; } else { ChkBoxStatus.Checked = false; } string position = dt.Rows[0]["Position"].ToString(); LoadPosition2DDL(position); string CultureCode = dt.Rows[0]["CultureCode"].ToString(); PopulateCulture2DDL(CultureCode); //BAT DAU XU LY IMAGE ====================================================== string ThumbImage = dt.Rows[0]["ThumbImage"].ToString(); string MainImage = dt.Rows[0]["MainImage"].ToString(); ViewState["ThumbImage"] = ThumbImage; ViewState["MainImage"] = MainImage; string file_path = string.Empty; if (ThumbImage.Length > 0) { if (ThumbImage.Substring(0, 3) == "http") { file_path = ThumbImage; } else { file_path = thumb_banner_dir_path + "/" + ThumbImage; } } else { file_path = "~/images/no_image.jpg"; } imgPhoto.Width = 50; imgPhoto.Height = 50; imgPhoto.ImageUrl = file_path; //KET THUC XU LY IMAGE ====================================================== }
private void LoadData() { BannerController banner_obj = new BannerController(); DataTable dt = banner_obj.GetDetailById(_idx); txtTitle.Text = dt.Rows[0]["Title"].ToString(); txtDescription.Text = dt.Rows[0]["Description"].ToString(); txtTags.Text = dt.Rows[0]["Tags"].ToString(); txtWidth.Text = dt.Rows[0]["Width"].ToString(); txtHeight.Text = dt.Rows[0]["Height"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["StartDate"].ToString())) { DateTime _StartDate = Convert.ToDateTime(dt.Rows[0]["StartDate"].ToString()); txtStartDate.Text = _StartDate.ToString("dd/MM/yyyy"); } if (!string.IsNullOrEmpty(dt.Rows[0]["EndDate"].ToString())) { DateTime _EndDate = Convert.ToDateTime(dt.Rows[0]["StartDate"].ToString()); txtEndDate.Text = _EndDate.ToString("dd/MM/yyyy"); } string Status= dt.Rows[0]["Status"].ToString(); if (Status == "1") ChkBoxStatus.Checked = true; else ChkBoxStatus.Checked = false; string position = dt.Rows[0]["Position"].ToString(); LoadPosition2DDL(position); string CultureCode = dt.Rows[0]["CultureCode"].ToString(); PopulateCulture2DDL(CultureCode); //BAT DAU XU LY IMAGE ====================================================== string ThumbImage = dt.Rows[0]["ThumbImage"].ToString(); string MainImage = dt.Rows[0]["MainImage"].ToString(); ViewState["ThumbImage"] = ThumbImage; ViewState["MainImage"] = MainImage; string file_path = string.Empty; if (ThumbImage.Length > 0) { if (ThumbImage.Substring(0, 3) == "http") file_path = ThumbImage; else file_path = thumb_banner_dir_path + "/" + ThumbImage; } else file_path = "~/images/no_image.jpg"; imgPhoto.Width = 50; imgPhoto.Height = 50; imgPhoto.ImageUrl = file_path; //KET THUC XU LY IMAGE ====================================================== }