错误与ASP.NET MVC页Ajax.Beginform [英] Error with Ajax.Beginform on ASP.NET MVC Page

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

问题描述

我使用Ajaxy调用加载的局部视图。这是在调试模式下工作在Firefox和IE没有罚款。
但在调试模式下,我得到了follwoing错误:

I am using Ajaxy Call to load the partial view. It is working fine in Firefox and IE without in Debug Mode. But in Debug mode, I am getting the follwoing error:

错误:'SYS'未定义

Error: 'Sys' is undefined

Ajaxy调用code:

Ajaxy call Code:

 <% using (Ajax.BeginForm("SearchResults", new AjaxOptions { UpdateTargetId = "divLoadSearchResults" } ))
{%>

HTML对应于此查看源文件:

HTML View Source corresponding to this:

<form action="/Home/SearchResults" method="post" onclick="***Sys.***Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'divLoadSearchResults' });">

我使用MVC RC2框架。任何人有RC2类似的问题?

I am using MVC RC2 framework. Anyone have similar problems with RC2?

如果它不是在调试模式下,它工作正常。同样,如果我使用调试模式或CTRL + F5运行它,它显示了错误。

If it is not in Debug mode, it is working fine. Again, if i run it using Debug mode or CTRL+F5, it shows up the error.

鸭preciate你的反应。

Appreciate your responses.

推荐答案

听起来像在不加载MicrosoftMvcAjax.js或MicrosoftAjax.js文件在调试模式下。检查要包括这些文件,并确保有没有那么将排除任何条件语句。如果您使用的是内容分发网络加载它没有调试时,请确保在交变载荷调试时的路径是正确的。

Sounds like it is not loading the MicrosoftMvcAjax.js or MicrosoftAjax.js files when in debug mode. Check where you are including these files and make sure that there aren't any conditionals that would exclude it. If you are using the content delivery network to load it when not debugging, make sure that the paths in the alternate loads when debugging are correct.

例如:

<% if (debug) { %>
     <script type="text/javascript"
             src="<%= Url.Content( "~/scripts/MicrosoftAjax.debug.js" ) %>">
      </script>
      <script type="text/javascript"
              src="<%= Url.Content( "~/scripts/MicrosoftMvcAjax.debug.js" ) %>">
      </script>
<% }
   else { %>
      <script type="text/javascript"
              src="http://ajax.microsoft.com/ajax/mvc/1.0/MicrosoftAjax.js">
      </script>
      <script type="text/javascript"
              src="http://ajax.microsoft.com/ajax/mvc/1.0/MicrosoftMvcAjax.js">
      </script>
<% } %>

这篇关于错误与ASP.NET MVC页Ajax.Beginform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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