Join Jess Chadwick for an in-depth discussion in this video Render data with strongly typed views, part of Learn ASP.NET Core MVC: The Basics.
- [Instructor] While the ViewBag property…is a convenient way to pass data around,…its dynamic nature often leaves a lot to be desired.…So, in this video I'm going to show you an alternative…to the dynamic ViewBag approach for passing…data from a controller to a view,…which is to pass a strongly typed model…into your view instead.…In order to create a strongly typed view,…we first need to create a type…that we can use as our model.…Before we do that,…let's create a model's folder in the root…of the application to hold all of our model classes in.…
It's important to note that like the controller classes,…it really doesn't matter to MVC…where you model classes live.…You'll often see this models folder…as a practical convention.…But these models can live anywhere,…even in another project.…In fact, that's usually a pretty good idea.…Anyway, regardless of where it lives,…let's create a brand new class.…Just a simple type named post,…with a couple of properties in it.…Title, posted, author, body et cetera.…Once we have this,…
- Building blocks of ASP.NET Core applications
- Creating a new project
- Responding to HTTP requests
- Serving static files
- Understanding the MVC pattern
- Handling requests with controllers
- Rendering HTML with Razor
- Rendering data, view markup, and view logic
- Creating HTML forms
- Validating form data
- Reading and writing from a database with Entity Framework
- Improving the user experience
- Exposing data with a web API
- Securing your ASP.NET application
Skill Level Intermediate
1. The Basics
2. The Model-View-Controller (MVC) Pattern
Understand routing4m 24s
3. Render HTML with Views
4. Work with Data
5. Improve User Experience with Ajax and Web APIs
6. Secure Your Application
Next steps1m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.