views:

32

answers:

1

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

+3  A: 

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>
Steve Michelotti
thanks but how to include them ?
radi
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.
Steve Michelotti