How do you clear the datebox
value?
On load my datebox
has the following data by default:
"01/01/0001 00:00:00"
From View:
@Html.TextBoxFor(m => m.Date, new { @id = "date", @name = "date", @data_role = "datebox",@value="", @data_options = " {'mode':'calbox' }", @onload="this.value='';" })
From Controller:
if you want to have an empty string in the textbox if the value is not given yet then you have to use Nullable DateTime in the Model:
class Model {
public DateTime? Date { get;set; }
}
The call in the view remains the same:
@Html.TextBoxFor(m => m.Date)