I have a Google map canvas inside an update panel
. The map refreshes its content(location) every time the update panel refreshes. I need to show some content in tabular format in the InfoWindow
.
The problem is that if I use html tags
in InfoWindow it shows up only for the first time when the application loads and when I am refreshing the update panel the application freezes. But if I use plain strings in InfoWindow the content shows up properly every time.
Here's the code in C# where I am generating the tabular content of InfoWindow.
sb.Append("<div id=\"content\"><table>");
foreach (DataRow dr in dt.Rows)
{
sb.AppendLine("<tr><td>" + dr[0].ToString() + "</td></tr>");
}
sb.Append("</table></div>");
This doesnt works after updating the update panel. However the below code works:
StringBuilder sb = new StringBuilder();
foreach (DataRow dr in dt.Rows)
{
sb.AppendLine(dr[0].ToString());
}
I am putting the generated string into a hiddenfield
and using it in js file like this:
var contentString = document.getElementById('InfoWindowString').value;
var infowindow = new google.maps.InfoWindow({
content: contentString
})
Can any one please tell me where I am going wrong.