开发者

MVC Post Binding, multiple instances of target type

开发者 https://www.devze.com 2023-03-02 16:41 出处:网络
I\'m running into a very strange issue. Essentially I\'m seeing a text box\'s value not be bound properly once I get to the controller\'s POST handler.

I'm running into a very strange issue. Essentially I'm seeing a text box's value not be bound properly once I get to the controller's POST handler.

Pretty simple really, I have an object with ZipPostalCode and am adding that to my view using TextBoxFor:

<%= Html.TextBoxFor(model => model.ZipPostalCode) %>

Adding breakpoints to the getter and setter for the property I开发者_JS百科 can see that I come through the property's Setter with the correct value and store it but the next time through I have a new instance of my model and as such don't have that value anymore.

Really baffling, any input is greatly appreciated.

Edit: It's worth mentioning that the object I'm passing to the view is an Entity Framework generated object

0

精彩评论

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