String concatenation with ASP.NET MVC3 Razor

后端 未结 5 1892
长发绾君心
长发绾君心 2021-01-08 00:43

i\'m trying to concatenate a string in asp.net mvc 3 razor and i\'m getting a little sintax problem with my cshtml.

i what to generate an id for my checkboxes on a f

5条回答
  •  终归单人心
    2021-01-08 01:24

    Best way to concate any C# variable in rozer view by using string.Format

    id="@string.Format("{0}_Title", _Id)" // Apend after
    id="@string.Format("Title_{0}", _Id)" // Apend before
    id="@string.Format("Title_{0}_Title", _Id)" // Apend Middle
    

提交回复
热议问题