Download presentation
Presentation is loading. Please wait.
Published byErica Jones Modified over 9 years ago
1
WebForm 實例 (ASP.NET) 台南市教育局網路中心 在職教師校務行政系統程式 開發進階班 asp@mail.tn.edu.tw 行政網路組
2
熟悉 Web Controls 實作各元件使用 實作報名表 Forms (Validate ……..) Panel 切換 String 處理 實作 IE Web Controls
3
File Upload with ASP.NET(1) 1. Setting up HTML form for file uploading 注意元件為 RunAt=server 2. Receiving uploaded file. protected System.Web.UI.HtmlControls.HtmlInputFile myFile; if(myFile.PostedFile != null ) { // 檔案上傳 } else { // 沒有檔案 }
4
File Upload with ASP.NET(2) 3. PostedFile property will contain a valid System.Web.HttpPostedFile object if file indeed was uploaded. HttpPostedFile provides us with 4 properties: ContentLength – size of uploaded file in bytes ContentType – MIME type of uploaded file, i.e. “ image/gif ” FileName – full path to uploaded file on client ’ s system, i.e. c:\Some folder\MyPicture.gif 4. 建立目錄 5.RTM 版本 --- 修改 machine.config 修正為 ………
5
File Upload with ASP.NET(3) PostedFile.SaveAs() IO 元件 Directory.GetFiles() File.Exists() File. Delete() 字串處理 LastIndexOf() Substring() WebControl-------Listbox 使用
6
File Upload with ASP.NET(4) 結合目錄及 upload 功能 --- 可做新增刪除修改
7
System.Drawing(1) Bitmap class and the Graphics class 第一步 Bitmap objBitmap = new Bitmap(width, height); 第二步 Graphics objGraphics=Graphics.FromImage(objBitmap);
8
System.Drawing(2) objGraphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, width, height); Font fontBanner=new Font(" 新細明體 ", 16, FontStyle.Bold); StringFormat stringFormat=new StringFormat(); stringFormat.Alignment = StringAlignment.Center; objGraphics.DrawString() objBitmap.Save() objGraphics.Dispose(); objBitmap.Dispose();
9
System.Drawing(3) 成果 : 自動產生圖型
10
System.Drawing(4) 成果 : 自動產生圖型 (2)
11
State Management in ASP.NET Client-side state management A. Cookies. if (Request.Cookies[ “ username ” ]!=null) lbMessage.text= ” Dear “ +Request.Cookies[ “ username ” ].Value+ ”, Welcome shopping here! ” ; else lbMessage.text= ” Welcome shopping here! ” ; B. Hidden Field C. View State D. Query Strings Server-side state management: A. Aplication object B. Session object C. Database
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.