MVC3 Html.DisplayFor — Is it possible to have this control generate an ID?

前端 未结 7 1764
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-08 17:16

I want to be able to display some text, but also have the text be modifiable via jQuery.

<%= Html.DisplayFor(model => model.DeviceComponentName)%>
         


        
7条回答
  •  清酒与你
    2021-02-08 17:55

    We Can't Create id for Displayfor() control in razor .. We can use html control like label of span instead of Displayfor() control . Other Wise we can put displayfor control in span control . now we can create id for span . this the way we have to do ..

    example @Html.Displayfor(modelItem => item.id)

提交回复
热议问题