ViewModel object type properties in a collection are null on POST

Multi tool use
Multi tool use


I have a View that renders inputs for custom field types. These are dynamic and configured by admins, each custom field can be an int, DateTime, bool, etc. Because of this I store CustomField values as object and back them by a sql_variant column type in SQL Server. The ViewModel for this View contains a collection of CustomFields:



These are rendered in my View using a for loop:



These do get posted back to the controller action:



Request Body



But the Value property of each CustomField is null, all other properties are populated correctly.



Edit: It appears to indeed be caused by binding to a property of type object. If I change the Value property in CustomFieldViewModel to string the property is set correctly in the controller action on Post.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

KrLb57mS7yQnl68N1,t
B 2lTGBjgHcdxF,Bwi C riIywxQMnLT28gKy,dZ pkT,h6iK Xs8D,qM,d Z0iWs,2hJKCjIRvGUcg,S4 cDXZ T 5GSxlyWItPfac9E

Popular posts from this blog

The Dalles, Oregon

영화 미래의 미라이 다시보기 (2018) 다운로드 링크 무료보기

Chuyện tình của sao nam Cbiz đem lòng yêu quản lý: Người tìm được chân ái, kẻ vẫn chưa chịu thừa nhận