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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

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

ios - I get the error Property '...' not found on object of type '...' -