Join Jess Chadwick for an in-depth discussion in this video Pass parameters to controller actions, part of Learn ASP.NET Core MVC: The Basics.
- [Instructor] One great thing about controller actions…is that they really are just methods,…which means that if you want to pass data into them,…you just go ahead and define a parameter on the method,…and ASP.NET Core MVC…will automatically populate that parameter from the request.…For example, in the blog application I'm building,…I'll need to be able to access a specific blog post…by some kind of identifier.…And I'll do that by passing the value of that identifier…through a method parameter on the action.…
To demonstrate, I'll add another action…to the blog's controller…by simply defining a new method named Post.…I'll have this new method accept a string parameter…named id.…And I'll have this method simply return the value…of the parameter right back to the user as content.…The name of this id parameter is very important…as ASP.NET Core MVC uses this name…to extract the value from somewhere in the request,…such as a query string or the body of a form post.…
In this case, I used the name id…because I wanted to pull this value from the id placeholder…
- 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.