Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a string property of Model

Tags:

asp.net-mvc

I am sure this is very simple, but I haven't found it yet.

I have an Model with a property of Message that I will set in the control.

What is the Html helper for this?

For example,

Html.TextBoxFor(m=> m.Message)

shows me the message, but it's in a textbox. I don't want the textbox, just the value.

Greg

like image 641
Greg Gum Avatar asked Dec 12 '13 21:12

Greg Gum


1 Answers

You can use two syntax:

@Html.DisplayFor(m => m.Message)

or

@Model.Title

You can read this question for details.

like image 55
Konrad Kokosa Avatar answered Nov 02 '22 07:11

Konrad Kokosa