How to get a IEnumerable<class> from c# in JavaScript -
in c# have 1 method
public ienumerable<office> pointoffices; private void preparemap(ienumerable<office> tdmaps) { var pointoffices = tdmaps office[] ?? tdmaps.toarray(); if (tdmaps == null || !pointoffices.any()) return; pointoffices = pointoffices; }
in javascript want each element of office , generate different html attributes of office class
i tried
var pointoffices =<%= pointoffices %>;
but gives me error: unexpected token ]
do need serialise class or method in js ? how can realize this?
do need serialise class or method in js?
yep!
check out json.net.
so in example should able this
public string serializedpointoffices { { return jsonconvert.serializeobject(this.pointoffices); } }
Comments
Post a Comment