Kieron
Kieron

Reputation: 27117

Does the ASP.NET MVC AjaxHelper deal with degradation?

Does anyone know if the AjaxHelper in the ASP.NET MVC framework deals with degradation?

For example, if you have an ActionLink that updates the content of a div, if JavaScript unavailable, will the page do a full postback by renderubg the page (via an action on a controller) and call the action specified in the ActionLink?

If not, how would you suggest making a page function correctly for browsers with JavaScript enabled and those who have it disabled within the context of an MVC app?

Upvotes: 4

Views: 588

Answers (2)

Maria Ines Parnisari
Maria Ines Parnisari

Reputation: 17496

You can specify an Url parameter to the AjaxOptions object to the Ajax.ActionLink call:

@Ajax.ActionLink(role, "GetPeopleData",
    new { selectedRole = role },
    new AjaxOptions
    {
        UpdateTargetId = "tbody",
        Url = Url.Action("GetPeopleData", new { selectedRole = role })
    })

Upvotes: 0

MrJavaGuy
MrJavaGuy

Reputation: 676

One thing you could try is in your controller, override the OnActionExecuted method and change the filerContext.ActionResult for non-JavaScript enabled browsers. You can also add you own ActionFilters to different actions in the controller.

Upvotes: 2

Related Questions