Slide 1

Slide 1 text

ASP.NET MVC - Code Templates實戰開發 Jerry http://www.dotblogs.com.tw/lastsecret

Slide 2

Slide 2 text

 快速開發範例實作  何謂ASP.NET MVC Templates?  範例實作:CLEditor & Uploadify  進階範例實作: UIHint 傳遞參數實作 DropDownList 2 大綱

Slide 3

Slide 3 text

3 何謂ASP.NET MVC Templates

Slide 4

Slide 4 text

Type DataType UIHint 4 Templates Model設定

Slide 5

Slide 5 text

 Html.Display(“PropertyName”)  Html.DisplayFor(model => model.PropertyName)  Html.DisplayForModel()  Html.Editor(“PropertyName”)  Html.EditorFor(model => model.PropertyName)  Html.EditorForModel() 5 Templates 呼叫方式

Slide 6

Slide 6 text

 ~/Views/ControllerName/DisplayTemplates  ~/Views/Shared/DisplayTemplates  ~/Views/ControllerName/EditorTemplates  ~/Views/Shared/EditorTemplates 6 Templates 資料夾位置

Slide 7

Slide 7 text

 Url  Email  Boolean  Html  Password  Time  Currency  More… 7 內建的Templates

Slide 8

Slide 8 text

 ASP.NET MVC 3 RTM Source Code  mvc3/src/MvcFuturesFiles/DefaultTemplates/DisplayT emplates/  mvc3/src/MvcFuturesFiles/DefaultTemplates/EditorTe mplates/ 8 內建的Templates

Slide 9

Slide 9 text

 Html 1. 使用 CLEditor 2. 擴充 Html 的 EditorTemplate  檔案上傳 1. 使用 Uploadify 2. 使用 UIHint 呼叫 Uploadify Template 9 擴充Templates

Slide 10

Slide 10 text

 擴充UIHint,使其可傳遞參數 1. Override DataAnnotationsModelMetadataProvider 2. Globol.asax 註冊 Providers 3. 自訂Helper 4. 使用UIHint 10 進階 – 擴充UIHint

Slide 11

Slide 11 text

 利用Entity Framework的edmx內的Model資訊產生 Controller、View、Service  Code Plex  T4 Metadata and Data Annotations Template 11 T4 + Templates 快速建構網站

Slide 12

Slide 12 text

12 Q & A

Slide 13

Slide 13 text

 官網:http://mvc.tw  臉書:http://fb.me/twmvc  G+ :http://mvc.tw/+ 13 twMVC