I have a simple search page html which i want to store the result type date format to html editor
My problem is my viewbag value date is succes retreive on controller but fail shown on cshtml
Maybe somebody help me
thank you
[HttpPost]
[Route("~/wo")]
public IActionResult Index(WorkOrder data)
{
var model = new WorkOrder();
using (IDbConnection conn = Connection)
{
var param = new DynamicParameters();
param.Add("@Imei", data.AVLUnitId);
model = conn.Query<WorkOrder>("GetWorkOrder", param,
commandType: CommandType.StoredProcedure).FirstOrDefault();
}
if (model != null)
{
ViewBag.WONumber = model.WONumber;
ViewBag.WorkDate = model.WorkDate;
ViewBag.VehicleNumber = model.VehicleNumber;
ViewBag.VehicleType = model.VehicleType;
ViewBag.MemberName = model.MemberName;
ViewBag.AVLUnitId = model.AVLUnitId;
ViewBag.ContactPerson = model.ContactPerson;
ViewBag.GSMNumber = model.GSMNumber;
ViewBag.WorkAddress = model.WorkAddress;
ViewBag.IsWarranty = model.IsWarranty;
}
return View(model);
}
<td>
@* <input type="date" class="custom" id="WorkDate" name="WorkDate" value="@ViewBag.WorkDate" /> *@
@Html.EditorFor(model => model.WorkDate, new { htmlAttributes = new { @class = "form-control", @Value = ViewBag.WorkDate } })
</td>
https://ibb.co/ZgLYpwz
I have Changed editor to input type, but my problem is why the format date 'mm/dd/yyyy' which i want to change it to dd-mm-yyyy
Thank you
<input id="datepicker" type="date" name="WorkDate" value="@ViewBag.WorkDate" class="form-control" pattern="[\d/]">