I have created a Datepicker for my Employee Create View and it is working great.
Below is the code;
- <link href="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/themes/cupertino/jquery-ui.css" rel="stylesheet" />
- @section Scripts {
- <script src="~/Scripts/jquery-1.12.4.min.js"></script>
- <script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
- <script>
-
- $(document).ready(function () {
- $("#DOB").datepicker({
- dateFormat: 'dd/mm/yy',
- changeMonth: true,
- changeYear: true,
- selectMonths: 12,
- yearRange: "c-70:"
-
- });
- });
- </script>
I have the same code for the Employee Edit View, however when I click on "Edit" the following error shows;
- Server Error in '/' Application.
-
- Input string was not in a correct format.
- Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
-
- Exception Details: System.FormatException: Input string was not in a correct format.
-
- Source Error:
-
-
- Line 99: @Html.LabelFor(model => model.DOB, htmlAttributes: new { @class = "control-label col-md-2" })
- Line 100: <div class="col-md-10">
- Line 101: @Html.EditorFor(model => model.DOB, new { htmlAttributes = new { @class = "form-control" } })
- Line 102: @Html.ValidationMessageFor(model => model.DOB, "", new { @class = "text-danger" })
- Line 103: </div>
-
- Source File: C:\Users\kyle\source\repos\LMKSystem\Views\Employee\Edit.cshtml Line: 101
-
- Stack Trace:
Below is the html for the DOB field in the Employee Edit view.
- <div class="form-group">
- @Html.LabelFor(model => model.DOB, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.EditorFor(model => model.DOB, new { htmlAttributes = new { @class = "form-control" } })
- @Html.ValidationMessageFor(model => model.DOB, "", new { @class = "text-danger" })
- </div>
- </div>
I would like to know how i can click on "Edit" so that the DOB that was captured on the Employee Create View will show in the Employee Edit View?
I have Googled and YouTuded alot and still can't find the answer, please help?
Thanking you in advance.
Regards,
Kyle