Skip to content
Loading
Bootstrap Datetime picker is not working in edit mode and getting erro  
  • class="col-md-3">  
  •   
  • class="input-group date form_time" data-date="" data-date-format="hh:ii" data-link-field="dtp_input3" data-link-format="hh:ii">  
  • @Html.TextBoxFor(model => model.CheckOut, "{0:hh:mm}" , new { @class = "form-control", autocomplete = "off" })  
  • class="input-group-addon">class="glyphicon glyphicon-remove">  
  • class="input-group-addon">class="glyphicon glyphicon-time">  
  •   
  • "hidden" id="dtp_input3" value="" />  
  •   
  • class="col-md-3">  
  •   
  • @Html.TextBoxFor(model => model.ShortLeave, new { @class = "form-control", Type = "decimal" , autocomplete = "off" })  
  •   
  •   
  •   
  • And Here's my Controller Code
    1. public ActionResult Edit(int? id)  
    2. {  
    3. if (id == null)  
    4. {  
    5. return new HttpStatusCodeResult(HttpStatusCode.BadRequest);  
    6. }  
    7. Attendance attendance = db.Attendance.Find(id);  
    8. if (attendance == null)  
    9. {  
    10. return HttpNotFound();  
    11. }  
    12. return View(attendance);  
    13. }  
    14. [HttpPost]  
    15. public ActionResult Edit(Attendance attendance)  
    16. {  
    17. if (ModelState.IsValid)  
    18. {  
    19. db.Entry(attendance).State = System.Data.Entity.EntityState.Modified;  
    20. db.SaveChanges();  
    21. return RedirectToAction("Index", "Attendance");  
    22. }  
    23. return View();  
    24. }  

    1 Reply

    Know the answer? Post it — somebody with the same question will find it here.