Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Date control is not showing value from model

$
0
0

I have this code

    [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}",ApplyFormatInEditMode = true)]
        [Required(ErrorMessage = "Captura este campo")]
        public DateTime? BirthDate { get; set; }
<div class="form-group"><label asp-for="BirthDate" class="control-label"></label><input asp-for="BirthDate"  asp-format="{0:dd/MM/yyyy}" value="@Model.BirthDate" class="form-control" /><span asp-validation-for="BirthDate" class="text-danger"></span></div>

Im sure model is retrieving value in the right format , but is not showing in the control, so everytime i am updating the object, i must to select date again.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>