Reputation: 12560
This is probably a silly question, but why am I unable to utilize Ajax in my project?
I should have all the necessary references:
System
System.Configuration
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Linq
System.Drawing
System.EnterpriseServices
System.Runtime.Serialization
System.Security
System.Web
System.Web.Abstractions
System.Web.Extensions
System.Web.Mobile
System.Web.Mvc
System.Web.Routing
System.Web.Services
System.Xml
System.Xml.Linq
I also added Ajax script references to my MasterPage, but this doesn't really matter at the moment since I cannot write code to utilize it.
Do I have to write a wrapper class that exposes these properties to my view? Or am I missing something else?
Thanks
code:
<div>
<p>
<%= Ajax.ActionLink("Test","AjaxTest",new AjaxOptions(UpdateTargetId = "test")) %>
</p>
<p id="test" visible="false">
Test Text
</p>
</div>
Upvotes: 0
Views: 603
Reputation: 870
as stated above, add the System.Web.Mvc.dll to your project, add a reference to System.Web.Mvc.Ajax, and use the following js files:
<script src="<%= Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script>
to actually start using it.
Upvotes: 0
Reputation: 351516
Make sure that you have referenced this assembly (which you obviously have give your list of using
statements):
System.Web.Mvc.dll
and also make sure that you import this namespace as well:
System.Web.Mvc.Ajax
Upvotes: 1