Search code examples
c#model-view-controllerdefault

MVC Store default values


I got a couple of columns in my database called CustomerID and ContentItemTypeID these have default values.

I know how to give them default values in my view but, I don't want to show the user the rows in the create view. So I want the default values to be stored in the code behind and for every item I create in my create view I want to default values to be filled in aswell.

Can anybody help me with this?


Solution

  • You can use hidden filled. example : @Html.HiddenFor(model => model.title)