websss
asked on
access C# object from Javascript - need help converting to the correct object in JS
I have an object in c# which is
it looks like this:
I'm calling this in c#
and then in my aspx page, i can successfully do this:
I now need to convert the object to the same type I had in the code behind, as i need to access x y data like [0,1] and retrieve the value 280
Any ideas how I would do that?
_temperatureData = new float[320, 240];
it looks like this:
I'm calling this in c#
System.Web.Script.Serialization.JavaScriptSerializer jSearializer = new System.Web.Script.Serialization.JavaScriptSerializer();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "genericName", "SendCSharpTempDataToJS(\'" + jSearializer.Serialize(_temperatureData) +"\');", true);
and then in my aspx page, i can successfully do this:
function SendCSharpTempDataToJS(_temperatureData) {
var mystring = "";
console.log(_temperatureData);
}
I now need to convert the object to the same type I had in the code behind, as i need to access x y data like [0,1] and retrieve the value 280
Any ideas how I would do that?
ASKER
thanks, that comes in as "undefined"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It appears your data is an array of values do you want to access a specific value or all values in the array?
Open in new window