Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

4 ASP.NET Views in MVC Part 4 || ASP.Net MVC Views

Автор: JB Technical

Загружено: 2024-01-03

Просмотров: 19

Описание:

Download Demo: https://drive.google.com/file/d/1ZzK_...

Download Slides: https://docs.google.com/presentation/...


In this video we will discuss views. Please watch Part 3 of MVC tutorial before watching this video. Let's change the Index method in HomeController to return a list of fruit names. Since fruit names are strings, return List of strings. Get rid of id and name parameters.

Run the application and notice that the output is not as expected.
System.Collections.Generic.List1[System.String]

To correct this problem, let's add a view to our project.
1. Right click on the Index() function
2. Click on "Add View"
3. Notice that, the view name in "Add View" dialog box matches the name of the controller action method
4. Select "Razor" as the view engine
5. Leave the rest of the defaults as is, and click "Add" button

We will discuss ViewBag & ViewData, and the differences between them in our next video session. For now, understand that, ViewBag & ViewData is a mechanism to pass data from the controller to the view.

Please Note: To pass data from controller to a view, It's always a good practice to use strongly typed view models instead of using ViewBag & ViewData. We will discuss view models in a later video session.

Please Note: We use "@" symbol to switch between html and c# code. We will discuss razor views and their syntax in a later video session.

4 ASP.NET Views in MVC Part 4 || ASP.Net MVC Views

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

array(0) { }

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]