Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

How to keep not displayed properties in MVC editor

$
0
0

I am using MVC editor to edit one of my class, there are a couple of properties I do NOT want to show on editor.

For example I have Class person {int ID, string Name, string Address, Decimal salary}, I passed a person object to the View, on the editor view, I only show Name, Address and let user able to edit them. After I submit the change, the posted person object only has Name and Address in it, the not displayed ID and Salary are back to 0. I tried use hidden field for ID, but not works.

How can I keep the values for all the properties even the ones not displayed on the View, especially "ID".


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>