【发布时间】:2012-06-15 09:50:26
【问题描述】:
我正在修复一些应用程序的错误,我需要帮助理解以下代码行:
这里, 查看:
@Html.RenderControlText("WFD_CONSENT")
控制器:
public static MvcHtmlString RenderControlText(this HtmlHelper htmlHelper, string controlType)
{
return htmlHelper.Action("ControlText", new { controlType = controlType });
}
这里的参数controlType = "WFD_CONSENT"。
我无法理解htmlhelper.Action() 函数在这里做什么。
从逻辑上讲,这个函数RenderControlText() 应该从某个地方获取一些数据,但它看起来不像。我在这里陷入了死胡同。
这个方法RenderControlText() 应该获取一些我保存在某处的文本,并显示出来。
编辑:Action() 方法具有以下参数:动作名称和对象路由值?
第二部分是什么:new { controlType = controlType }?这个路由值有什么作用??
【问题讨论】:
标签: asp.net-mvc-3