<!--Razor C#-->
@for (int i = 0; i < 10; i++)
{
<baobao>good</baobao>
}
<!--输出.-->
@{
dynamic aa = new ExpandoObject();
aa.qq = "qq";
}
<div>@(ViewBag.Cname).Cname</div>
<!--输出Email-->
<div>fiybird@sina.com</div>
<!--输出字符串-->
@aa.qq
<!--代码块形式输出-->
@{
Response.Write(aa.qq);
}
<!--输出html-->
@{
string strhtml = "<input type='text'/>";
}
@strhtml
@{
Response.Write(strhtml);
}
@Html.Raw(strhtml);
<!--html转译-->
@{
HtmlString htmlrow = new HtmlString("<input type='button' value='按钮'/>");
Response.Write(htmlrow.ToHtmlString());
}
<!--视图调用另一个页面-->
@{Html.RenderPartial("Index");}
<!---视图声明方法-->
@helper RadioList(string names,string value,string value1)
{
<ul>
<li><input type="radio" name="'+names+'" value="@(value)" checked="checked" />@(value)</li>
<li><input type="radio" name="'+names+'" value="@(value1)" />@(value1)</li>
</ul>
}
@RadioList("a", "男", "女");