Hi nauna,
I have created sample that full fill your requirement by refering the below link.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&key=AIzaSyBojHBt73ZegOGb2Kj8boi0HXMKRyfftVg"></script>
<script type="text/javascript">
window.onload = function () {
var addresses = document.getElementById("<%=hfAddresses.ClientID %>").value.split(':');
var mumbai = new google.maps.LatLng(18.9750, 72.8258);
var mapOptions = {
center: mumbai,
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var latlngbounds = new google.maps.LatLngBounds();
var markers = new Array();
for (i = 0; i < addresses.length; i++) {
var address = addresses[i];
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var Latlng = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
var marker = new google.maps.Marker({
position: Latlng,
map: map,
title: results[0].formatted_address
});
markers.push(marker);
latlngbounds.extend(marker.position);
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(marker.title);
infoWindow.open(map, marker);
});
if (markers.length == addresses.length) {
map.setCenter(latlngbounds.getCenter());
map.fitBounds(latlngbounds);
}
} else {
alert("Request failed.")
}
});
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" />
<br />
<asp:Label ID="Label2" runat="server" />
<div id="dvMap" style="width: 500px; height: 500px">
</div>
<asp:HiddenField ID="hfAddresses" runat="server" />
</form>
</body>
</html>
C#
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Highcombe Cl, London SE9 4QH, UK";
Label2.Text = "Chislehurst BR7 5QP, UK";
List<string> addresses = new List<string>();
addresses.Add(Label1.Text);
addresses.Add(Label2.Text);
hfAddresses.Value = string.Join(":", addresses);
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Label1.Text = "Highcombe Cl, London SE9 4QH, UK"
Label2.Text = "Chislehurst BR7 5QP, UK"
Dim addresses As New List(Of String)()
addresses.Add(Label1.Text)
addresses.Add(Label2.Text)
hfAddresses.Value = String.Join(":", addresses)
End Sub
Screenshot