How do I create a MVC Razor template for DisplayFor()

前端 未结 6 1321
小蘑菇
小蘑菇 2020-12-03 03:07

I have a couple of properties in my view model that are display-only but I need to retrieve their values using jQuery to perform a calculation on the page. The standard

6条回答
  •  一向
    一向 (楼主)
    2020-12-03 03:24

    You could make this id part of the view model and use it in the display template:

    @Html.DisplayFor(x => x.Value)
    

提交回复
热议问题