Access displayName attribute from the model in MVC View

前端 未结 8 708
不思量自难忘°
不思量自难忘° 2021-02-06 22:51

If my model have

[DisplayName(\"First Name\")]
public string firstName { get; set; }

Then I can print it in the View with LabelFor



        
8条回答
  •  别跟我提以往
    2021-02-06 23:35

    @(This.Model.acc_first)

    Should work

    so in javascript you can use it like

    function callme(val)
    {
       //some ajax call with 
       @(This.Model.acc_first)
    }
    

提交回复
热议问题