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

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -