user2985419
user2985419

Reputation: 553

Display text in a view

I am developing a MVC application in C# and and have a question about displaying text in a view.

I have the following code that does work:

@Html.EditorFor(model => model.Book.Name)

Here is the code that I have written that does not work:

Book Name: @Html.DisplayText(model => model.Book.Name)

May I have some help to get the correct syntax for the above code? I am wanting to display the contents of the model.Book.Name as simple text.

Upvotes: 0

Views: 638

Answers (1)

Ryan Schlueter
Ryan Schlueter

Reputation: 2221

Book Name: @Html.DisplayFor(model =>  model.Book.Name)

Upvotes: 1

Related Questions