ASP.Net MVC – issue with Ajax.ActionLink

mvc-logoYesterday, I was cursing at my new ASP.Net MVC project. I was trying to use Ajax.ActionLink to refresh the part of the page which uses Ajax. Well, it should be very straightforward but I failed due to one minor mistake… I took care of everything- I used proper call in Controller (RenderPartial), I checked 10 times if I passed the correct div id, I debugged it at least 20 times and still my page, after Ajax request, was rendered like it didn’t have a  Site.Master code around it…

My problem – after Ajax request my page was rendered incorrectly

When I launched Ajax.ActionLink on my page, as a result I got the incorrectly rendered view. Have a look at these two pictures below:

Picture 1 My page before launching "test" link which is Ajax.ActionLink

Picture 2 My page after it. You an see that It rendered without rest of the page

Ajax.ActionLink – is not only C# code

In order to find out where the  mistake was made I took a different example (Contact Manager from ASP.Net MVC site) and I checked once again why my Ajax.ActionLink was not working. I was really surprised to see it working there perfectly well but not working in my own project even though I followed the exact same steps… well, almost everything.

Don’t forget to include MicrosoftAjax

That was my mistake. I forgot to include two javascripts in my Site.Master page. Stupid, I know.

<script src=”../../Scripts/MicrosoftAjax.js” type=”text/javascript”></script>

<script src=”../../Scripts/MicrosoftMvcAjax.js” type=”text/javascript”></script>

What really made me angry was the fact that without these two lines everything was working, no error messages from Visual Studio! The only simple difference was that when you entered Controller method responsible for handling the Ajax Request, the IsAjaxRequest was returning false even though you used Ajax.ActionLink to launch it.

That was my yesterday lesson on how to use ASP.Net MVC. I still think that this is a really good framework. Just like Rob Conery said in his video , it is like driving a motorcycle.


Sometimes you will get bugs in your mouth. Yesterday, I ate the whole bucket of them. Feel free to leave a comment below or exchange your ideas through Twitter @GOYELLO.


<script src=”../../Scripts/MicrosoftAjax.js” type=”text/javascript”></script>

<script src=”../../Scripts/MicrosoftMvcAjax.js” type=”text/javascript”></script>


Aspire Blog Team

Aspire Systems is a global technology services firm serving as a trusted technology partner for our customers. We work with some of the world's most innovative enterprises and independent software vendors, helping them leverage technology and outsourcing in our specific areas of expertise. Our services include Product Engineering, Enterprise Solutions, Independent Testing Services and IT Infrastructure Support services. Our core philosophy of "Attention. Always." communicates our belief in lavishing care and attention on our customers and employees.


  1. ive seriously spent all day banging my head against my keyboard and searching for every example in existence. i wish i found this one first.

  2. It looks good,I have learn a recruit!
    Recently,I found an excellent online store, the XX are completely various, good quality and cheap price,it’s worth buying!

  3. Hhe article's content rich variety which make us move for our mood after reading this article. surprise, here you will find what you want! Recently, I found some wedsites which commodity is research-laboratory colorful of fashion. Such as that worth you to see. Believe me these websites won’t let you down.

  4. I get the same error with you but I still have no glue for it. I have even insert MicrosoftAjax and MicrosoftMvcAjax already

Comments are closed.