简体   繁体   中英

Set default date Html.jQuery().DatePicker()

<td colspan="2"><% Html.jQuery().DatePicker()
                        .Name("birth_date")
                        .DateFormat("dd-mm-yy")
                        .MaximumValue(DateTime.Now.AddYears(-15))
                        .MinimumValue(DateTime.Now.AddYears(-100))
                        .NavigationAsDateFormat(true)
                        .Value(Model.birth_date)
                        .Render(); %></td>

by default it shows 01-01-001, I want to set the default date.

Set the Model.birth_date value, its default value may be is DateTime.MinDate . So, that's why it shows 01-01-001 .

<%Model.birth_date = DateTime.Now.AddYears(-15) ;  %>

这给了我想要的结果

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM