I've created an object of class in controller in asp.net mvc and pass it to view page by view model,
This object has many methods that return different data type (xmldocument, string, int, array, etc)
I've used the following way to access any methods @Model.Getxml().ChildNodes.Count"
"@Model.Getxml().ChildNodes[0].InnerText
I want to declare a variable of this object in javascript and call any methods that I want from the variable like the following
var obj=@Model
And then access any methods from obj variable
But I have a problem when I write loop for tracing elements in array like the following
var size=parseInt("@Model.Getxml().ChildNodes.Count");
for (var i=0; i<size; i++)
{
document.writeln ("@Model.Getxml().ChildNodes[i].InnerText");
}
This code didn't work, Help would be appreciated.