<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<title>CodeProject: Google's static map API WebControl. Free source code and programming help</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Description" content="Shows you how to build an image based WebControl displaying static maps with markers.; Author: Florian DREVET; Section: ASP.NET Controls; Chapter: Web Development">
<meta name="Keywords" content=".NET 2.0, C# 2.0, C#, ASP.NET, .NET, Dev, Design, Intermediate,ASP.NET Controls,Web Development,Free source code, tutorials">
<meta name="Author" content="The Code Project">
<meta name="Rating" content="General">
<meta name="Robots" content="index, follow">
<meta name="Revisit-After" content="1 days">
<link rel="alternate" type="application/rss+xml" title="CodeProject Lounge Postings" href="http://www.codeproject.com/webservices/LoungeRSS.aspx">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - All topics" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=1">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - MFC / C++" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=2">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - C#" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=3">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - ASP.NET" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=4">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - .NET" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=5">
<link rel="alternate" type="application/rss+xml" title="CodeProject Latest articles - VB.NET" href="http://www.codeproject.com/webservices/articlerss.aspx?cat=6">
<link rel="search" type="application/opensearchdescription+xml" title="CodeProject" href="http://www.codeproject.com/info/OpenSearch.xml">
<link rel="stylesheet" type="text/css" href="GoogleStaticMapWebControl.aspx_files/CodeProject.css">
<link rel="stylesheet" type="text/css" href="GoogleStaticMapWebControl.aspx_files/ForumClassic.css">
<!-- base -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="GoogleStaticMapWebControl.aspx_files/ga.js" type="text/javascript"></script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-1735123-1");
pageTracker._setDomainName("www.codeproject.com");
pageTracker._setSessionTimeout("1200"); // 20 mins
pageTracker._initData();
pageTracker._trackPageview();
</script>
<script type="text/javascript" language="Javascript" src="GoogleStaticMapWebControl.aspx_files/oncopy.js"></script>
<script type="text/javascript" language="Javascript" src="GoogleStaticMapWebControl.aspx_files/jxs.js"></script>
<script type="text/javascript" language="Javascript" src="GoogleStaticMapWebControl.aspx_files/bookmark.js"></script>
<script type="text/javascript" language="Javascript" src="GoogleStaticMapWebControl.aspx_files/rateitem.js"></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
function ToggleMenu(itemName)
{
var elm = document.getElementById(itemName);
var i,others = document.getElementById('SectionMenu');
for(i=0; i < others.childNodes.length; i++)
{
var other = others.childNodes[i];
if ((other.className == 'MenuSectionBlock') && (other != elm))
other.style.display='none';
}
if (elm.style.display == 'block') elm.style.display='none';
else elm.style.display='block';
return false;
}
//]]></script>
<script type="text/javascript" language="Javascript" src="GoogleStaticMapWebControl.aspx_files/addto.js"></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
function MsgVoteForm(MemberID,MsgID,GB,gp,bp,mt) {
if(!GB)document.write("Rate this message: ");
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"5":"1")+unescape(");\"%3E"));
if(GB) document.write(unescape("%3Cimg height=\"24\" width=\"24\" src=\"/script/Forums/Images/good.png\" alt=\"good\" border=\"0\" align=\"absmiddle\" /%3E "+gp+" "+mt+"%3C/a%3E "));
else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_down.gif\" alt=\"vote 1\" border=\"0\" align=\"middle\" /%3E%3C/a%3E "));
if(GB)document.write(" "); else for(var i=1; i<=5;i++)
document.write(unescape("%3Ca class=\"Frm_MHL\" href=\"#xx" + MsgID.toString() + "xx\" title=\"vote this message a " + i.toString() + "\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ", " + i.toString() + ")\"%3E%3Cb%3E" + i.toString() + "%3C/b%3E%3C/a%3E "));
document.write(unescape("%3Ca href=\"#xx" + MsgID.toString() + "xx\" onclick=\"RateMsg(" + MemberID.toString() + ", " + MsgID.toString() + ","));document.write((GB?"1":"5")+unescape(");\"%3E"));
if(GB)document.write(unescape("%3Cimg height=\"24\" width=\"24\" src=\"/script/Forums/Images/bad.png\" alt=\"bad\" border=\"0\" align=\"absmiddle\" /%3E "+bp+" "+mt+"%3C/a%3E"));
else document.write(unescape("%3Cimg height=\"14\" width=\"14\" src=\"/script/Forums/Images/thumbs_up.gif\" border=\"0\" alt=\"vote 5\" align=\"middle\" /%3E%3C/a%3E "));
}
function ReportMsg(userid, msgid, score) {
if (confirm("Are you sure you want to report this message?") == true)
return RateMsg(userid, msgid, score);
else return false;
}
function RateMsg(memberid, msgid, score) {
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (req.readyState == 4) {
if ( req.status == 200 ) {
var respText = req.responseText;
var re = new RegExp(unescape("\%3Cdiv\%3E([^\%3C]*)\%3C/div\%3E"), "g");
var match = re.exec(respText);
voteStatus.innerHTML = unescape("%3Cb%3E") + (match)?match[1]:"An error occured" + unescape("%3C/b%3E");
}
else
{
voteStatus.innerHTML = unescape("%3Cb style='color:red'%3EFailed!") + req.statusText + unescape("%3C/b%3E");
}
}
}
var voteStatus = document.getElementById("MVF" + msgid);
if (!voteStatus) return;
voteStatus.innerHTML = unescape("%3Cb style='color:green'%3EVoting...%3C/b%3E");
var strAction = "/script/Forums/Vote.aspx?js=1&fmid="+memberid.toString()+"&select="+msgid.toString()+"&score="+score.toString();
req.open("GET", strAction, true);
req.send(null);
return false;
}
//]]></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
var Selected = "-1";
function SwitchMessage(e, msgId)
{
if (!msgId) {
if(!e)e=window.event;
var target=e.target?e.target:e.srcElement;
while(target&&target.id!='DynMessLink')target=target.parentNode;
if(!target||target.id!='DynMessLink')return;
msgId=target.name;
}
if(Selected&&Selected!=""){
var body=eval("document.getElementById('F" + Selected + "_h1')");
if(body) body.style.display = 'none';
var head=eval("document.getElementById('F" + Selected + "_h0')");
if(head) head.className = head.className.replace("Sel", "UnSel");
}
if(Selected==msgId.toString())
Selected="";
else {
Selected=msgId.toString();
var body=eval("document.getElementById('F" + Selected + "_h1')");
if(body){
if(body.style.display=='none') body.style.display='';
else body.style.display = 'none';
}
var head=eval("document.getElementById('F" + Selected + "_h0')");
if (head)
head.className = head.className.replace("UnSel", "Sel");
if(body&&head&&body.style.display!='none'){