- ASP.NET MVC 2 Cookbook
- Andrew Siemer, Richard Kimber
- 301字
- 2021-04-09 22:44:22
In this chapter, we will cover:
- Using magic strings and the
ViewData
dictionary - Creating a strongly typed view
- Decoupling a strongly typed view with a View Model
- Centralizing display logic with templated helpers
- Using a partial view to segment view code
- Rendering a child view with
Html.RenderAction
- Building a view from the database with NVelocity
- Consuming a JSON view with jQuery
In this chapter, we will take a look at the easiest part of the whole ASP.NET MVC framework—the View. We will get started by looking at how data is passed out to the view in the simplest of ways using the ViewData
dictionary and magic strings. From there, we will work towards better ways of getting data in and out of the view. Then we will take a look at some of the other view engines that you have at your disposal, which can easily be plugged into the ASP.NET MVC framework. Finally, we will take a look at other things that you can do with the view.
In our examples, we will be working with the basic concept of products and categories as though we were building a simple e-commerce site. We will be using an open source product called NBuilder to fake our data access layer. NBuilder will be used to quickly generate some product and category data for us to use in our views.
Note
NBuilder is a great open source product that can be used to quickly generate test instances of a particular .NET class. This works great when knocking together your views such as we are doing in this chapter. You can find more data about NBuilder at NBuilder.org. I also wrote a tutorial on how to get NBuilder running on DotNetSlackers.com at dotnetslackers.com/articles/aspnet/Using-NBuilder-to-mock-up-a-data-driven-UI-Part1.aspx.
- Instant Vert.x
- AutoCAD快速自學寶典(2018中文版)
- AutoCAD Civil 3D 2018 場地設計實例教程
- Inkscape 0.48 Illustrator's Cookbook
- 24小時全速學會Photoshop 2021
- 攝影輕松入門:Photoshop后期處理
- 量化投資與FOF投資:以MATLAB+Python為工具
- Photoshop CS6從入門到精通
- Illustrator CC平面設計標準教程(微課版)
- Photoshop CC 2017 淘寶美工設計實例教程
- Origin科技繪圖與數據分析
- 企業虛擬化實戰:VMware篇
- 動畫制作基礎(項目教學版)
- Photoshop CC新媒體圖形圖像設計與制作(全彩慕課版)
- SQL Server 2005數據挖掘與商業智能完全解決方案