MVC项目中的Ajax.ActionLink [英] Ajax.ActionLink in MVC project

查看:57
本文介绍了MVC项目中的Ajax.ActionLink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在学习MVC,并且作为其中的一部分,我创建了一个MVC项目.
由于我需要菜单和子菜单,因此我在网上搜索并找到了超级鱼的css和javascript,并添加了它们.
然后我想添加一个Ajax按钮,所以我看到了@ Ajax.ActionLink
的许多示例 在我的项目中,出于某种原因,它无法识别@Ajax.它为我提供了将其用作"System.Web.Mvc.Ajax"的功能,但后来却无法识别ActionLink方法.

这是我来自_Layout.cshtml
的参考

Hi,

I''m learning MVC, and as part of it I created an MVC project.
Since I needed menus and sub-menus I searched the net and found the superfish css and javascripts, and added them.
Then I wanted to add an Ajax button, so I saw many example of @Ajax.ActionLink
In my project, out of some reason it doesn''t recognize the @Ajax. It offers me to use it as "System.Web.Mvc.Ajax" but then it doesn''t recognize the ActionLink method.

here are my references from the _Layout.cshtml

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/superfish.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.2.6.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/hoverIntent.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/superfish.js")" type="text/javascript"></script>
    
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/themes/redmond/jquery-ui.css" rel="Stylesheet" type="text/css"   />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
    <script src="<%= Url.Content("~/Scripts/MicrosoftAjax.debug.js") %>" type="text/javascript"></script>  
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.debug.js") %>" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>



我在做什么错?



What am I doing wrong?

推荐答案

不要使用Microsoft AJAX东西.糟透了使用jQuery.它使您可以更好地控制生成的内容,并且通常更标准,更灵活.

您的jquery版本已过时.
Don''t use the Microsoft AJAX stuff. It sucks. Use jquery. It gives you a lot more control over what is generated and is in general more standard, and more flexible.

Your jquery version is way out of date.


这篇关于MVC项目中的Ajax.ActionLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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