asp.net mvc 3 - non-nullable value types in editor template for insert -


I need help with solving a design decision roadblock with a colleague.

  public square fu {public date time} FooDate I do not respect my views very much, but likes to post questions on stack overflow, so here goes :)  

Suppose I have the following model: {Received; Set; }}

In my template, I want to create a form to update / insert this model, so I have the following code:

  @ (Html.BeginForm (...)) is using {... @Html.EditorFor (m = & gt; m.FooDate) ...}   

one While updating, set this value of the textbox to the value of the current model, which is good though, when I do a blank model to put one, then this text box will be replaced by 1/1/0001 < / Code> That is not good, which is not good.

It is clear to me why this happens, and the solution seems to make the FooDate faucet and put a [required] attribute on it My colleague does not accept this, because FooDate property is not really worth trying.

The second option will be different templates for Inserts and Updates. I suppose, but it seems that in other cases the same is worthless.

Has anyone else gone into this dilemma? If so, which route have you taken to solve it?

I replied that it is useful for you or not. I think this can solve your problem.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -