I have a large form in a Razor view and want to make certain form elements disabled depending on the state of the model object I'm passing in. So some logic has to be defined to determine whether to show this element, make it read-only or make it editable.
My current thinking is leading me to define some Razor @helper's with the logic there, although I'm not sure if that's the best way to do it. Kind of like ...
@helper determineElementStatus(string modelProperty)
{
if (modelProperty == someState) {
@Html.TextBoxFor....etc
}
}
@determineElementStatus(model.someProperty)
Indeed I'm not sure if the view is the right place. It is presentation logic in the fact that it changes the appearance of the form, but is it best place elsewhere and how??. Help would be appreciated.