超文本标记语言不能动态调度ActionLink

本文关键字:ActionLink 动态调度 不能 超文本标记语言 | 更新日期: 2023-09-27 17:54:20

我的MVC3有问题

我试图使用@Html.ActionLink()在我的博客项目中生成标题链接。

ActionLink中使用常量字符串工作得很好,但如果我使用Posts.Title(当前Post模型的标题被循环),我得到这个异常:

CS1973: 'System.Web.Mvc.HtmlHelper<dynamic>' has no applicable method 
named 'ActionLink' but appears to have an extension method by that name.  
Extension methods cannot be dynamically dispatched. Consider casting  
the dynamic arguments or calling the extension method without the  
extension method syntax.

超文本标记语言不能动态调度ActionLink

"考虑强制转换动态参数或调用不使用扩展方法语法的扩展方法。"

职位。Title没有类型(因此是动态参数)。

直接通过(string)Posts.Title进行强制转换。