Monday 1 February 2021

MVC - Add DateTimePicker to textbox

 

 Watch this example on YouTube


 

1. Install NuGet - jQuery-DatetimePicker

2. View

@{
    ViewBag.Title = "Home Page";
}

<input id="dt1" type="text" />
<link href="~/Content/jquery.datetimepicker.css" rel="stylesheet" />
@section Scripts{
    <script src="~/Scripts/jquery.datetimepicker.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#dt1').datetimepicker();
        });
    </script>    
}

 

No comments:

Post a Comment