Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1005
h:mm tt and the igDateEditor
posted

If I prepopulate my HTML control as follows:

@Html.TextBox(string.Empty, Model.Value.ToString("h:mm tt"), new { @class = "form-control timecontrol", @type = "time" })

and then initialize my igDateEditor as follows:

$('.timecontrol').igDateEditor({ dateInputFormat: "h:mm tt", dateDisplayFormat: "h:mm tt", width: "100%", allowNullValue: true, buttonType: "spin" });

When I select the control to edit the value the editor goes blank and I lose the value set via my @Html.TextBox call.

If I change my MVC text box call to the following it works but obviously flashes the full date value for a second first:

@Html.TextBox(string.Empty, Model.Value.ToString(), new { @class = "form-control timecontrol", @type = "time" })