ModifyBook.aspx.cs
上传用户:tjxpgg
上传日期:2017-05-14
资源大小:2244k
文件大小:1k
源码类别:

SilverLight

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class Admin_ModifyBook : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.     }
  16.     protected void DetailsBook_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
  17.     {
  18.         FreeTextBoxControls.FreeTextBox ftbToc = this.DetailsBook.FindControl("FreeTextBoxToc") as FreeTextBoxControls.FreeTextBox;
  19.         e.NewValues["TOC"] = ftbToc.Text;
  20.     }
  21.     protected void Button1_Click(object sender, EventArgs e)
  22.     {
  23.         string isbn=(this.DetailsBook.FindControl("LblISBN") as Label).Text;
  24.         FileUpload upload = this.DetailsBook.FindControl("FileUploadCover") as FileUpload;
  25.         if (upload.FileName.Substring(upload.FileName.Length-4,4).ToLower() != ".jpg")
  26.         {
  27.             Response.Write("<script language='javascript'>alert('文件类型错误');</script>");
  28.         }
  29.         else
  30.         {
  31.             string filename = Server.MapPath("~/Images/BookCovers/") + isbn + ".jpg";
  32.             upload.PostedFile.SaveAs(filename);
  33.         }
  34.     }
  35. }