How To Display Variable Value In View?

How To Display Variable Value In View?

There are several ways. For example simply using @ like this:

<td>
    @y
</td>

Or by using a <span> tag like this:

<span>Your Text @(y) ...</span>

Or using Html.Label helper:

@Html.Label("lblName", y)

可以不加括号的

@{

  var str="hello world";

}

使用的时候 @str

 

posted @ 2019-08-27 10:52  ChuckLu  阅读(132)  评论(0编辑  收藏  举报