Hello all,
I need to display a google map on contact us page with location.For that i use java script in java script there is multi dimensional array looks like below.
var locations = [
//For Ahmedabad Location
['addressline 1 </br> Country', 13.012895, 12.503075],
//for new Delhi location
['addressline 1 </br> Country', 18.654401, 717.152701],
];
And i got the properties value from back office like using nested content.
var MapLocationList = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("setLocationsOnMap");
from above code i got all the values that i need.
Now i convert this values into c# string array.using following code.
string[] array = new string[MapLocationList.Count()];
if (MapLocationList.Any())
{
int i = 0;
foreach (var item in MapLocationList)
{
var Addresss = Umbraco.Field(item, "fullAddress");
var latitude = Umbraco.Field(item, "latitude");
var longitude = Umbraco.Field(item, "longitude");
string[] childarray = new string[1];
childarray[0] = "['" + Addresss + "'," + latitude + "," + longitude + "]";
array[i] = childarray[0];
i = i + 1;
}
}
Now i must have to give the array values to java script location multi -dimension array.
Now my question is how can i set java script values dynamically.
any help would be appreciated.
Ronak Panchal.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/75778-how-to-set-dynamic-values-to-java-script-two-dimensional-array