I use @(new JavaScriptSerializer().Serialize(Model.DateSlotModel)))in my view and it causes a javascript error because in the script block it produces the following:
var initialData = [{"DateID":"1","DateValue":"4/1/2011"}]);
What do I need to do to get the output file as follows?
[{"DateID":"1","DateValue":"4/1/2011"}]
Controller Code:
jobmodel.DateSlotModel = from d in eventRepository.GetEventDates(eventid)
select new ScheduleDateSlotViewModel
{
DateID = d.DateID.ToString(),
DateValue = d.DateValue.ToShortDateString()
};
thank
source
share