Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9320915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:45:10+00:00 2026-06-19T03:45:10+00:00

In Razor I can turn off Autocomplete on a textbox by doing this: @Html.EditorFor(model

  • 0

In Razor I can turn off Autocomplete on a textbox by doing this:

@Html.EditorFor(model => model.UserName, new { autocomplete = "off" })

Is there a way I can specify this in the ViewModel using DataAnnotations instead of in the View?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:45:12+00:00Added an answer on June 19, 2026 at 3:45 am

    I don’t think there is a standard way to manipulate html attributes from ViewModel attributes with the EditorFor extension method.

    However, you can create a custom html helper method if you want to keep it DRY.

    Btw I don’t think that it would be a great idea to encapsulate these kind of informations (html attributes) inside a ViewModel class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I reduce this razor code? <li> @{ if (@Model.PublicationDate.HasValue) { @Model.PublicationDate.Value.ToString(D, new System.Globalization.CultureInfo(fr-FR))
MVC RAZOR VIEW Html.EditorFors decimal places can be controlled with Dataannotations but there is
Can you guys please check this code, it is MVC3 Razor <p><strong><u>Skills:</u></strong> @foreach (var
I'm a new bie with MVC3 razor. Can anyone please help me why I
I have the following razor template html, although I can't figure out how to
I'm kind of new to razor MVC, and I'm wondering how can I read
Can someone else confirm that autocomplete HTML tags is not working in Visual Studio
Can i use mvc2 controls with new Razor engine?
how i can translate this code into razor syntax: <% for (int i =
I have a asp.net website in the umbraco cms, there I can use razor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.