C# ASP.NET MVC2 Ajax ActionLink调用错误的操作
我正在尝试使用Ajax更改页面上的一些数据。这是一段代码:C# ASP.NET MVC2 Ajax ActionLink调用错误的操作,c#,ajax,asp.net-mvc-2,actionlink,C#,Ajax,Asp.net Mvc 2,Actionlink,我正在尝试使用Ajax更改页面上的一些数据。这是一段代码: <%= Ajax.ActionLink("Rate Up", "RatePost", new { postId = post.Id, rating = 1 }, new AjaxOptions { UpdateTargetId = string.Format("postRating_{0}", count) })%> 问题是点击此链接后,RatePost操作未被调用。相反,将调用父视图操作。我如何才能避免这种情况,并使
<%= Ajax.ActionLink("Rate Up", "RatePost", new { postId = post.Id, rating = 1 }, new AjaxOptions { UpdateTargetId = string.Format("postRating_{0}", count) })%>
问题是点击此链接后,RatePost操作未被调用。相反,将调用父视图操作。我如何才能避免这种情况,并使用我指定的参数调用RatePost操作?代码似乎是正确的 验证您是否在视图中包含Microsoft Ajax脚本:
<script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript">/script>
<script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script>
/script>
如果由
Ajax.ActionLink
生成的javascript出现故障,则不会取消单击操作。您的RatePost
操作方法中的代码是什么?