Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            DataSet ds = DBEntity.Tab_CourseMain_Type.GetDs();
            this.ddlCourseType.DataSource     = ds.Tables[0];
            this.ddlCourseType.DataTextField  = "CourseMainType";
            this.ddlCourseType.DataValueField = "Idx";
            this.ddlCourseType.DataBind();
            //==========================
            string idx = Request["Idx"];
            if (!String.IsNullOrEmpty(idx))
            {
                DBEntity.Tab_CourseMain ent = new DBEntity.Tab_CourseMain();
                ent                     = ent.Get(idx);
                this.Title.Text         = ent.Title;
                this.CourseContent.Text = ent.CourseContent;
                this.Image1.ImageUrl    = string.Format("~/upload/CourseMain/{0}", ent.PreviewImg);
                this.SortNo.Text        = ent.SortNo.ToString();
                this.ReleaseDate.Text   = ent.ReleaseDate.ToString();

                for (int i = 0; i < this.HomeShowBool.Items.Count; i++)
                {
                    if (this.HomeShowBool.Items[i].Value == ent.HomeShowBool)
                    {
                        this.HomeShowBool.Items[i].Selected = true;
                    }
                }
                for (int i = 0; i < this.ddlCourseType.Items.Count; i++)
                {
                    if (this.ddlCourseType.Items[i].Value == ent.CourseMainTypeIdx_Fx.ToString())
                    {
                        this.ddlCourseType.Items[i].Selected = true;
                    }
                }

                this.hiddenFileName.Value = ent.PreviewImg;

                //========
                DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select  * from Tab_CourseMain  where Idx=@Idx"
                                                        , new SqlParameter("Idx", idx)).Tables[0];
                if (dt.Rows.Count == 1)
                {
                    this.ActivityDescption.Text = dt.Rows[0]["ActivityDescption"].ToString();
                    this.ActivityUrl.Text       = dt.Rows[0]["ActivityUrl"].ToString();
                }
            }
        }
    }