Search code examples
asp.net-mvchtml-helper

which HTML helper bypasses all templates and renders a simple string?


this question I got from some tests:

Which of the following templated HTML helpers of MVC bypasses all templates and renders a simple string representation of the specified model property?

and options:

  1. Display
  2. Label
  3. DisplayText
  4. Editor

as I understand, it means, that which helper displays property as string? The correct answer is Label?


Solution

  • the correct answer is DisplayText and don't get confused with DisplayTextFor which is a strongly typed version of DisplayText and returns the annotation value of your model attribute (if predefined) or null otherwise