0

I have an object "product" build from a database. it has 3 attributes : - Id can't be NULL - Ref can't be NULL - Designation can be NULL

So I'm using an AjaxForm and @Html.EditorFor(model => model.Designation) to update the "Designation" field My problem is when my Controller received the "product" object, Product's Id is well filled with the original value, however Product's Ref is null

I thought about 2 solutions : Add a Ref Field in my AjaxForm not editable, or the worst : In my controller research the ref of my product using the Id ( very bad :s )

Could you advice me about how to do this clean. Thank you !

1
  • Add a hidden field for the Ref property. Commented Feb 7, 2013 at 15:06

1 Answer 1

1

You probably have to add in the Ref Field, so that the page knows about mapping that field when it goes back to your controller, but you can make it hidden using HiddenFor:

@Html.HiddenFor(model => model.Ref)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.