Ok,
I would in normal asp.net use a theme to turn off autocomplete on all text boxes on an entire site. However i cannot do this on MVC because nothing in the theme
ASP.net MVC HTML Attribute: Which is having type="text" Managed by JQUERY code
@Html.TextBoxFor(model => model.FirstName, new {@id = "txtFirstName"})
<script language="javascript" type="text/javascript">
$(document).ready(function () {
try {
$("input[type='text']").each(function () {
$(this).attr("autocomplete", "off-1");
});
}
catch (e) { }
});
</script>
AFAIK, you cannot do autocomplete = off
with css and it has to be a html attribute and hence there is nothing you can that would affect all Textboxes. One thing you can do is add the attribute to the form like this (it will address all textboxes in the current form)
Html.BeginForm(action,controller, FormMethod.Post, new { autocomplete="off"})
or create a custom Helper extension method that is similar to BeginForm
that adds this html attribute internally.
@Html.TextBox("Address","",new { @class = "classname", autocomplete = "off" })