How to set a google map url dynamically from code behind

Thursday, July 3, 2014

I want to set a map url dynamically from code behind. e.g gmap.Attributes.Add("src", branchurl);


Map.aspx.cs



protected void newLocation_Click(object sender, EventArgs e)
{
//retrieve the url from database & assign it to a variable "branchurl"
gmap.Attributes.Add("src", branchurl);
}


Map.aspx



<div class="mapbox" style="margin-top: 0px;">
<iframe id="gmap" width="100%" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://ift.tt/1ofYuEa"></iframe>
</div>


I tried using gmap.Attributes.Add("src", branchurl); but does not work.







http://ift.tt/1lYEfwI