I have created a form that uses a bootstrap datepicker to allow the user to input the date, and the methods used work perfectly when testing on my localhost. A problem occurred when i uploaded the site to do a final test which switches the date format throughout my site from dd/MM/yyyy to dd-MM-yyyy even though i have converted the date using global.asax culture settings. This date format wouldn't be such an issue but my forms no longer submit and the error i get says "sequence contains no elements" I have checked all settings on both the server and in the site that could be causing this but cannot seem to fix the issue. Thanks in advance for any suggestions.
Convert the date to the specified format on the front end:
protected void Application_Start()
CultureInfo newCulture = new CultureInfo("en-ZA");
newCulture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
newCulture.DateTimeFormat.DateSeparator = "/";
Thread.CurrentThread.CurrentCulture = newCulture;
Thread.CurrentThread.CurrentUICulture = newCulture;
_vehicle[c] = new Vehicle()
inceptionDate = string.IsNullOrEmpty(frm["inception_" + c]) ?
(IsFleetClient ? DateTime.Now.Date.AddDays(1) : DateTime.Now.Date) :
Convert.ToDateTime(frm["inception_" + c]).ToLocalTime()