0

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.

Saurabh R S
  • 3,037
  • 1
  • 34
  • 44

1 Answers1

0

I checked the Javascript console in the browser and found the error message A potentially dangerous Request.Form value was detected from the client
Using the following Stackoverflow links - this and this I found that validateRequest is to be set to false in the Page directive: validateRequest="false"

Hope this helps anyone else facing the same problem.

Community
  • 1
  • 1
Saurabh R S
  • 3,037
  • 1
  • 34
  • 44