lundi 27 juillet 2015

Can you use @model like @ViewBag?

So I have a question about model in ASP.NET MVC. I know I can use a ViewBag like this: <h1> @ViewBag.Question </h1> and it would display the text in @ViewBag.Question. Can I use @model in the same way? I have tried using it in the same context, <h1> @Model.Question </h1> but the view throws an error. How can I display the text of a model property inside an html element?

Aucun commentaire:

Enregistrer un commentaire