dimanche 22 novembre 2015

How to generate "1. Do the homework" from "@Model.Number. @Model.Task" in razor?

I need to generate a string which looks like variable, dot, space, another variable.

The @Model.Number. @Model.Task or @(Model.Number). @(Model.Task) or @{Model.Number}. @{Model.Task} doesn't seem to compile.

The @Model.Number<text>. </text>@Model.Task works, but it generates a trashy <text> tag in the resulting html.

If I place all of these on a separate line:

@Model.Number
. 
@Model.Task

then the result will render with an extra space between the number and the dot.

The @Model.Number@:. @Model.Task doesn't compile either.

Aucun commentaire:

Enregistrer un commentaire