Razor---服务器端标记语言

Razor 是一种允许您向网页中嵌入基于服务器的代码(Visual Basic 和 C#)的标记语法
<ul> @for (int i = 0; i < 10; i++) { <li>@i</li> } </ul>

<select >
@if (ViewBag.userList != null && ViewBag.userList.Count > 0)
{
foreach (var item in ViewBag.userList)
{

<option value="@item.UserId">@item.RealName - @item.Account</option>
}
}
</select>

@switch(day)
{
case "Monday":
    message="This is the first weekday.";
    break;
case "Thursday":
    message="Only one day before weekend.";
    break;
case "Friday":
    message="Tomorrow is weekend!";
    break;
default:
    message="Today is " + day;
    break;
}
<p>@message</p>
posted @ 2018-11-29 14:06  lovebear  阅读(430)  评论(0编辑  收藏  举报