1
Reply

Is there any to restrict user do not able change the some of model value in mvc?Please do not use read only css or like that.

Jatin Patel

Jatin Patel

Dec 21, 2016
396
0

    there are two way to have read only model properties. 1. using attribute [HiddenInput(displayValue="false")] - this attribute hide propertyin the model. when template scaffolding used to create CRUD based views then hidden property not visible in a view. 2. using attribute[ReadOnly(true)] - this attribute is an safest way to make property as read only and its value does not change though we have assign an value to property.

    Santosh Gadge
    April 19, 2017
    0