2

i am reading the professional asp.net mvc book and implement the nerd Dinner example and when start to use Ajax :

<%: Ajax.ActionLink( "RSVP for this event", "Register", "RSVP", new { id=Model.DinnerID }, new AjaxOptions { UpdateTargetId="rsvpmsg" }) %> <% } %> 

all right, but when click on "RSVP for this event" link the IE display error message :

"Sys is undefined"

and when click debug it refer to the line :

<a href="/RSVP/Register/4" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: &#39;rsvpmsg&#39; });">RSVP for this event</a> 

i know that "Sys" should be "System" but how to fix that .

thnks

1 Answer 1

6

The error messages are correct. You need to make sure you're including the correct javascript files in your view:

<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> 
Sign up to request clarification or add additional context in comments.

2 Comments

Just paste the 2 lines of code above onto your page. some people like to put it on the MasterPage so it's available for all views in the application.
Excelent! It seems that Ajax.ActionLinks realisation no longer depends from jquery.unobstrusive-ajax.js

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.