1

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:

Error: 'Sys' is undefined

Ajaxy call Code:

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

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' });">

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

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.

Appreciate your responses.

1 Answer 1

3

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.

Ex:

<% 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>
<% } %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.