Enviar búsqueda
Cargar
Hokuriku.NET ASP.NET MVC 入門 2 回目 3.効率的なビュー開発
•
7 recomendaciones
•
4,837 vistas
M
miso- soup3
Seguir
2012/11/24 ASP.NET MVC 入門 2 回目 の資料の一部です。
Leer menos
Leer más
Denunciar
Compartir
Denunciar
Compartir
1 de 18
Descargar ahora
Descargar para leer sin conexión
Recomendados
50分で掴み取る ASP.NET Web API パターン&テクニック
50分で掴み取る ASP.NET Web API パターン&テクニック
miso- soup3
Blend for visual studio 2013の新機能
Blend for visual studio 2013の新機能
一希 大田
かずきのUWP入門
かずきのUWP入門
一希 大田
2016/05/01 Visual Studio with Cordova
2016/05/01 Visual Studio with Cordova
miso- soup3
2016/12/17 ASP.NET フロントエンドタスク入門
2016/12/17 ASP.NET フロントエンドタスク入門
miso- soup3
Visual Studio 2017 RC C# まわり
Visual Studio 2017 RC C# まわり
miso- soup3
OWIN って何?
OWIN って何?
miso- soup3
One ASP.NET, OWIN & Katana
One ASP.NET, OWIN & Katana
miso- soup3
Recomendados
50分で掴み取る ASP.NET Web API パターン&テクニック
50分で掴み取る ASP.NET Web API パターン&テクニック
miso- soup3
Blend for visual studio 2013の新機能
Blend for visual studio 2013の新機能
一希 大田
かずきのUWP入門
かずきのUWP入門
一希 大田
2016/05/01 Visual Studio with Cordova
2016/05/01 Visual Studio with Cordova
miso- soup3
2016/12/17 ASP.NET フロントエンドタスク入門
2016/12/17 ASP.NET フロントエンドタスク入門
miso- soup3
Visual Studio 2017 RC C# まわり
Visual Studio 2017 RC C# まわり
miso- soup3
OWIN って何?
OWIN って何?
miso- soup3
One ASP.NET, OWIN & Katana
One ASP.NET, OWIN & Katana
miso- soup3
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Más contenido relacionado
Destacado
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Destacado
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Hokuriku.NET ASP.NET MVC 入門 2 回目 3.効率的なビュー開発
1.
お悩み解決!! 効率的なビュー開発
2.
お悩み解決!!
効率的なビュー開発 ビューのコードが複雑になってしまう・・・ 重複コードをなくしたい・・・ Html の記述は量が多いので、大変。スピーディに行いたい。 ASP.NET MVC って、生産性悪いんでしょう? どのような実装かわかりませんが、これから紹介する方法で 解決できるかもしれません。 初めて開発する方も知っておくとお得です。 ただの Tips ではありません。 立派な ASP.NET MVC のビュー機能 をご紹介します。
3.
お品書き カスタム Html
ヘルパー 同じ Html 要素を書いた時には、これ! 宣言型 Html ヘルパー ビューで複雑な処理を書いた時には、これ! 部分ビュー 同じ画面を書いた時は、これ!で統一 Html.Action 画面の中に、まったく違う性質の情報を表示することに なった時には、これ! テンプレート機能 この型はこの表示、と決まっていたらテンプレートを 作ろう!
4.
1. カスタム Html
ヘルパー @Html.ActionLink(…) などと同じように、自分で Html ヘルパーを作成します。 Html ヘルパー は、 HtmlHelper オブジェクトを引数に持ち、 MvcHtmlString を返す拡張メソッドです。 作成するときは、同じように拡張メソッドを作成します。
5.
2. 宣言型 Html
ヘルパー ビューの記述が複雑になってしまった時、 関数のように利用することができます。
6.
2. 宣言型 Html
ヘルパー App_Code フォルダの中に作成すると、 全ビューから参照することができます。 共通する文章等は、ここに記述するとよいかもしれません。
7.
3. 部分ビュー 共通する部分を、別ファイルとして作成し、 複数のビューで共有することができます。
_Form.cshtml Create.cshtml (部分ビュー) Edit.cshtml
8.
3. 部分ビュー 作成した部分ビューを表示したい時は、 このように記述します。 第1引数は、部分ビューの名前を指定します。 部分ビューで利用する Model
を指定することもできます。 下の用に書くこともできます。 が、違いはほとんどありません。
9.
4. Html.Action 1つのページにまったく性質の違う情報が複数ある場合、 無理に1つのアクションメソッドに処理を書く必要はありません。 Html.Action を利用します。
最新情報 日記 Details.cshtml
10.
4. Html.Action Html.Action は、指定したアクションの結果を出力することが できます。(別のアクションメソッドの処理を呼ぶことができる、 というイメージです)
最新情報 日記 Details.cshtml
11.
4. Html.Action 利用するときは、ビュー側で、以下のように記述します。 引数では、コントローラやアクションを指定します。 以下の様に書くこともできます。 が、違いはほとんどありません。
12.
5. テンプレート この項目は、この表示方法で、 この項目は、このような入力方法で、 といった決まりを、テンプレートとして作成し、利用することができます。 テンプレートは、 表示用
と 編集用 の2種類に分けることができます。
13.
5. テンプレート 利用する場合 表示用: 編集用: 以上のように記述すると、 項目の型情報などから、どのテンプレートを利用するか判断し、 そのテンプレートを利用して出力されます。
14.
5. テンプレート テンプレートの作成方法 作成用: DisplayTemplates
フォルダ内 編集用: EditorTemplates フォルダ内 に作成します。 場所は、Shared または、各コントローラフォルダ内に置きます。
15.
5. テンプレート テンプレートの選択方法
型情報から、テンプレートが選択されます。 [UIHint(“Name”) ] → Name.cshtml を検索 [DataType(DataType.Url)] → Url.cshtml を検索 プロパティの型(String) → String.cshtml を検索
16.
5. テンプレート 既に ASP.NET
MVC に登録されているテンプレートもあります。 bool , DataType.Url , DataType.EmailAddress, などなど・・・ 注意! DataType の属性をつけたからといって、 検証を行ってくれるわけではありません。
17.
おしまい カスタム Html
ヘルパー 同じ Html 要素を書いた時には、これ! 宣言型 Html ヘルパー ビューで複雑な処理を書いた時には、これ! 部分ビュー 同じ画面を書いた時は、これ!で統一 Html.Action 画面の中に、まったく違う性質の情報を表示することに なった時には、これ! テンプレート機能 この型はこの表示、と決まっていたらテンプレートを 作ろう!
18.
おしまい たくさんのビュー機能がありましたが、
どれも、Html の制御は隠ぺいされていません。 これが、 ASP.NET MVC の利点でもあり 欠点でもあります。 次にご紹介する JavaScript 開発は、 Html 制御が可能な ASP.NET MVC だからこそ 容易にできる部分です。
Descargar ahora