ASP.NET MVC AjaxHelper 是否处理降级?

发布于 2024-07-10 00:58:50 字数 246 浏览 4 评论 0原文

有谁知道ASP.NET MVC框架中的AjaxHelper是否处理降级?

例如,如果您有一个更新 div 内容的 ActionLink,如果 JavaScript 不可用,页面是否会通过 renderubg 页面(通过控制器上的操作)进行完整回发并调用 ActionLink 中指定的操作?

如果没有,您建议如何为启用了 JavaScript 的浏览器以及在 MVC 应用程序上下文中禁用 JavaScript 的浏览器正确创建页面功能?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

×眷恋的温暖 2024-07-17 00:58:50

您可以尝试的一件事是在控制器中重写 OnActionExecuted 方法并更改不支持 JavaScript 的浏览器的 filerContext.ActionResult 。 您还可以将自己的 ActionFilter 添加到控制器中的不同操作中。

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.

吝吻 2024-07-17 00:58:50

您可以为 Ajax.ActionLink 调用的 AjaxOptions 对象指定 Url 参数:

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

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 })
    })
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文