Hi
I'm working on an asp.net ajax mvc application
I used Ajax.ActionLink method to add a link for updating span context using ajax, here is some part of my code :
...
<span id="status">No Status</span>
<%=Ajax.ActionLink("Update Status", "GetStatus", new AjaxOptions { UpdateTargetId = "status" })%>
...
but when I run application & click on created link, i get this error :
Microsoft JScript runtime error: 'Sys.Mvc.AsyncHyperlink' is null or not an object
can anybody help me please ???
thanks
views:
427answers:
4Have you checked that the script you added to the page is :
<script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
... check the spelling of MicrosoftMvcAjax. it should not be MicrosoftAjaxMvc.
Make sure you do this:
<script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
And not this:
<script src="/Scripts/MicrosoftMvcAjax.js" type="text/javascript" />
I couldn't believe that the latter does not work!
I also go the same error. Can you please let me know how did u solve this error.
<% = Ajax.ActionLink("Sort by Name in the grid", "SortEmployeeGrid", new { arg = SortingHelpers.SortParameter(lastSort, "EmpName", 3) }, sortOptions)%>
And here are my sort options
AjaxOptions sortOptions = new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId="divMVCEmployeeGrid"
};
You have to make sure you include the javascript functions for AJAX on your web page:
I made a typo when I included the MicrosoftMvcAjax.js on my code, and got the same error.
If your application isn't at the top directory of your page, you can use the below code to resolve where your Scripts directory for your app is at.
<%
string scriptsDir = Page.ResolveUrl("~/Scripts/");
%>
<script src="<%=scriptsDir %>MicrosoftAjax.js" type="text/javascript"></script>
<script src="<%=scriptsDir %>MicrosoftMvcAjax.js" type="text/javascript"></script>
Thanks!