how to detect when a page is called using ajax in asp.net mvc ?
You can check it manually like this:
bool isAjaxRequest = request.Headers["X-Requested-With"] == "XMLHttpRequest";
Or when you're in a Controller in ASP.NET MVC, which references System.Web.Mvc you will get an extension-method on the HttpRequestBase object, which you can access within an ActionMethod like this:
bool isAjaxRequest = Request.IsAjaxRequest();