protected void btnSubmit_Click(object sender, EventArgs e) { string fileName = this.hiddenFileName.Value; if (myFileUpload.HasFile) { Cmn.uploadFile upF = new Cmn.uploadFile(); string[] allowExtensions = { ".jpg", ".gif", ".png" }; int maxSize = Convert.ToInt32(Cmn.WebConfig.getApp("app_MaxSizeUpload")); string savePath = Request.MapPath("~/upload/CourseMain/"); fileName = myFileUpload.FileName; try { upF.Upload(this.myFileUpload, allowExtensions, maxSize, savePath, fileName); } catch (Exception exp) { Cmn.Js.ShowAlert(exp.Message); return; } } DBEntity.Tab_CourseMain ent = new DBEntity.Tab_CourseMain(); ent.Idx = int.Parse(Request["Idx"]); ent.Title = this.Title.Text; ent.PreviewImg = fileName; ent.CourseContent = this.CourseContent.Text; ent.HomeShowBool = this.HomeShowBool.SelectedValue; ent.SortNo = Convert.ToInt32(this.SortNo.Text); ent.ReleaseDate = DateTime.Parse(this.ReleaseDate.Text); ent.CourseMainTypeIdx_Fx = Convert.ToInt32(this.ddlCourseType.SelectedValue); ent.Update(ent); string strSql = "update Tab_CourseMain set ActivityDescption='{0}' ,ActivityUrl='{1}' where Idx='{2}'"; strSql = string.Format(strSql, this.ActivityDescption.Text, this.ActivityUrl.Text, Request["Idx"]); SqlHelper.ExecuteNonQuery(CommandType.Text, strSql); Cmn.Js.ShowAlert("操作成功!"); Cmn.Js.ExeScript("location.href='CourseMainManage.aspx'"); }