ASP.NET MVC剃刀渲染 [英] ASP.NET MVC Razor rendering

查看:116
本文介绍了ASP.NET MVC剃刀渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么以下code使我的孩子动作:

Why does the following code renders my child action:

<div class='h-l'>
  @if (ViewBag.Hide)
  {
     @Html.Action(MVC.City.GetCitiesList().AddRouteValue("makeBig", false));
  }
</div>

但如果我在 @ Html.Action 删除@,没有呈现?

推荐答案

MSDN

ChildActionExtensions.Action方法。
调用子操作方法并返回结果作为HTML字符串。

ChildActionExtensions.Action Method.
Invokes a child action method and returns the result as an HTML string.

您应该使用 @ 来确定一个字符串的方法。看看 ASP.Net @符号

You should use @ to determine a string as a method. Take a look at ASP.Net @ Symbol

这篇关于ASP.NET MVC剃刀渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆