Популярное

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

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

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

Топ запросов

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

Part 57 Razor views in mvc

Автор: kudvenkat

Загружено: 2013-07-16

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

Описание:

Link for code samples used in the demo
http://csharp-video-tutorials.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

Link for csharp, asp.net, ado.net, dotnet basics, mvc and sql server video tutorial playlists
   / kudvenkat  

Make sure to replace [ with LESSTHAN and ] with GREATERTHAN symbol.

In this video, we will discuss razor view syntax.

Use @ symbol to switch between c# code and html.
@for (int i = 1; i [= 10; i++)
{
[b]@i[/b]
}

Output:
1 2 3 4 5 6 7 8 9 10

Use @{ } to define a code block. If we want to define some variables and perform calculations, then use code block. The following code block defines 2 variables and computes the sum of first 10 even and odd numbers.
@{
int SumOfEvenNumbers = 0;
int SumOfOddNumbers = 0;

for(int i =1; i[=10; i++)
{
if(i %2 == 0)
{
SumOfEvenNumbers = SumOfEvenNumbers + i;
}
else
{
SumOfOddNumbers = SumOfOddNumbers + i;
}
}
}

[h3]Sum of Even Numbers = @SumOfEvenNumbers[/h3]
[h3]Sum of Odd Numbers = @SumOfOddNumbers[/h3]

Output:
Sum of Even Numbers = 30
Sum of Odd Numbers = 25

Use [text] element or @: to switch between c# code and literal text
@for (int i = 1; i [= 10; i++)
{
[b]@i[/b]
if (i % 2 == 0)
{
[text] - Even [/text]
}
else
{
[text] - Odd [/text]
}
[br /]
}

The above program can be re-written using @: as shown below.
@for (int i = 1; i [= 10; i++)
{
[b]@i[/b]
if (i % 2 == 0)
{
@: - Even
}
else
{
@: - Odd
}
[br /]
}

Output:
1 - Odd
2 - Even
3 - Odd
4 - Even
5 - Odd
6 - Even
7 - Odd
8 - Even
9 - Odd
10 - Even

Part 57   Razor views in mvc

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

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

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

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

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

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

Part 58   Razor views in mvc continued

Part 58 Razor views in mvc continued

Part 59   Layout view in mvc

Part 59 Layout view in mvc

Part 73   OutputCache attribute in mvc

Part 73 OutputCache attribute in mvc

Part 86   ValidationSummary in asp net mvc

Part 86 ValidationSummary in asp net mvc

Part 70   Authorize and AllowAnonymous action filters in mvc

Part 70 Authorize and AllowAnonymous action filters in mvc

Mr Bean does 'Blind Date' | Comic Relief

Mr Bean does 'Blind Date' | Comic Relief

Совет старика.

Совет старика.

Most Ridiculous Worker Mistakes Caught on Camera

Most Ridiculous Worker Mistakes Caught on Camera

Chicago Blues Music – Relaxing Soulful Blues Collection Vol.010

Chicago Blues Music – Relaxing Soulful Blues Collection Vol.010

Советский способ увеличения количества отжиманий (современный)

Советский способ увеличения количества отжиманий (современный)

My project was stolen and sold for profit

My project was stolen and sold for profit

The Windows 11 Disaster That's Killing Microsoft

The Windows 11 Disaster That's Killing Microsoft

I'm 73... It Took Me 52 Years To Learn This (Don't Waste Yours)

I'm 73... It Took Me 52 Years To Learn This (Don't Waste Yours)

Part 62   Implementing search functionality in asp net mvc

Part 62 Implementing search functionality in asp net mvc

Pink Floyd - The Dark Side Of The Moon (50th Anniversary) [2023 Remaster] {Full Album}

Pink Floyd - The Dark Side Of The Moon (50th Anniversary) [2023 Remaster] {Full Album}

Kriss Drummer Hears

Kriss Drummer Hears "Baba O'Riley" For The First Time

Part 52   Partial views in mvc

Part 52 Partial views in mvc

How To Learn So Fast It’s Almost Unfair

How To Learn So Fast It’s Almost Unfair

Part 71   childactiononly attribute in mvc

Part 71 childactiononly attribute in mvc

I Quit Every Streaming Service… Here’s What I Use Now.

I Quit Every Streaming Service… Here’s What I Use Now.

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



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



Контакты для правообладателей: infodtube@gmail.com