如何关闭自动完成关闭在asp.net MVC一个Ajax形式 [英] How to turn autocomplete off in an Ajax form in asp.net MVC

查看:141
本文介绍了如何关闭自动完成关闭在asp.net MVC一个Ajax形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了剃须刀一个Ajax形式。但我需要关闭自动完成整个中的形式。在一个正常的形式,我可以通过HTML属性自动完成=关闭,但我找不到只接受一个最好的超载 AjaxOptions htmlAttributes (任何类型)

I have created an Ajax form in razor. But I need to turn off auto-completion in entire form. In a normal form, I could pass html attribute autocomplete = "off" but I can't find a best overload that accepts only AjaxOptions and htmlAttributes (of any type)

好<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.mvc.ajax.ajaxextensions.beginform%28v=vs.100%29.aspx\"相对=nofollow>此页面没有说明所有 Ajax.BeginForm 17重载()。它只有11定义在那里。

Well this page does not describe all of 17 overloads of Ajax.BeginForm(). It has only 11 definitions there.

那么我的函数调用就像

using (Ajax.BeginForm(new AjaxOptions() { ... }))
{
    ...
}

我列出了一些重载那些包含 htmlAttribute 的任何类型的定义。

Ajax.BeginForm(string actionName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)

Ajax.BeginForm(string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)

Ajax.BeginForm(string actionName, string controllerName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<string,object> htmlAttributes)

Ajax.BeginForm(string actionName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<string,object> htmlAttributes)

AjaxBeginForm(string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes)

请告诉我哪一个是我可以利用没有任何其他功能的影响。或任何其他的解决方案中添加自动完成=关闭格式标记..?

Please tell me which one is that I can make use of without any other functional effect. Or any other solution to add autocomplete="off" in form tag..?

推荐答案

试试这个,

@using (Ajax.BeginForm("Index", "Home", null, 
        new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result" }, 
        new {autocomplete ="off"})
       )

这篇关于如何关闭自动完成关闭在asp.net MVC一个Ajax形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆