I have a spurious problem which seems to indicate the index value got from the jquery each method does not always start at 0.
My javascript looks a bit like this:
$("#mylist").each(function(index) {
var obj = new myclass();
obj.property = "whatever";
obj.sequence = index + 1;
parentobj.list.push(obj);
});
This all gets packaged into json and ajaxed (please pardon verb usage) back to the server. The server then deserialises the json into .net objects. It's at this point I get an error:
The value '91111' cannot be parsed as the type 'Int16'.
This is at the point it tries to push the sequence value into a short field.
I cannot recreate this (always happens to other users). I may be able to add some debug code to the javascript files in question during a quiet period but there's no guarantee it will happen then.
There also seems to be a strange pattern to the values. The values in the log are: 61111, 81111, 91111, 111111, 211111, 311111. These neither ascend or descend and sometimes repeat.
Can anyone shed a light on this or confirm that I cannot trust the index to start from zero?
Thanks