开发者

How can I use a prefix for the fields in my strongly typed View?

开发者 https://www.devze.com 2022-12-24 13:17 出处:网络
I have an EditProfile action in my PersonCont开发者_Go百科roller, that finds a Person object by ID and does return View(person). The EditProfile view has a bunch of fields that should be filled in wit

I have an EditProfile action in my PersonCont开发者_Go百科roller, that finds a Person object by ID and does return View(person). The EditProfile view has a bunch of fields that should be filled in with the information from the Person object. One of the fields is named "Person.FirstName", and is not filled in automatically when the View is rendered. However, if I rename the textbox to "FirstName", it gets filled in.

My question is: How can I specify to the view that it should use the "Person" prefix when filling in the information from the Person object?

The reason I want to do this is because of consistency - in some of my views I allow the user to edit more than one object at the same time, and use prefixes in order to bind these correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号