Controller Code :
public ActionResult Index()
{
PersonRepository repo = new PersonRepository();
PersonListModel lstPersons = new PersonListModel();
lstPersons.Persons = repo.GetAllPerson();
return View(lstPersons);
}
Actual Javascript Code :
<script type="text/javascript">
var personListData = @Html.Raw(Json.Encode(Model.Persons));
var viewModel = {
personsModel : ko.observableArray(personListData)
}
ko.applyBindings(viewModel)
<script/>
Result while Debugigng :
var personListData = [
{"PersonId":324783035204000026,"FirstName":"Gibbbs","BirthDate":"\/Date(1347647400000)\/"},{"PersonId":324126155204000001,"FirstName":"Russel","BirthDate":"\/Date(1347561000000)\/"}];
*Question :
when the model data get bindinng it will show me person id as : 324783035204000026 but when the binding process get complete it make change into PersonId as : 324783035204000000 and 324126155204000001 to 324126155204000000
Date data is also not binding properly.
so what is the main reason behind it ?
please help me if you have any idea about this.