天天看點

AspNet MVC4 教學-23:Asp.Net MVC4 Display And Editor 模闆技術高速應用Demo

A.建立Basic類型的項目.

B.在Model檔案夾下,建立3個檔案:

Role.cs:

Teacher.cs:

Student.cs:

C.建立HomeControlller.cs:

D.建立View:

在Shared以下建立目錄:EditorTemplates,然後在當中再建立兩個檔案:

Role.cshtml:

String.cshtml:

在Shared以下建立目錄:DisplayTemplates,然後在當中再建立兩個檔案:

在Home以下建立4個檔案:

Index.cshtml:

Student.cshtml:

StudentDetails.cshtml:

TeacherDetails.cshtml:

F.在Site.css檔案裡的末尾添加: