0

i have code which one point work fine
now i want to multiple point for address
this is code

.aspx.cs

for (int i = 0; i < dt.Rows.Count; i++)
        {
            string address = Convert.ToString(dt.Rows[i]["Address"]) + "," + Convert.ToString(dt.Rows[i]["Pincode"]) + "," + Convert.ToString(dt.Rows[i]["City"]);
            Page.RegisterStartupScript("map_canvas", "<script language='javascript' type='text/javascript'>searchAddress('" + address + "');</script>");
        }

//Javascript file is

var map = null;
var geocoder = null;
    
function initialize() 
{
  if (GBrowserIsCompatible()) 
  {

    map = new GMap2(document.getElementById("map_canvas"));

    map.setCenter(new GLatLng(37.4419, -122.1419),15);
    //map.addControl(new GScaleControl());
    //var boxStyleOpts = {opacity: .2, border: "2px solid yellow" };
    //var otherOpts = { buttonStartingStyle: {width: '17px', height: '17px', display:'none'},overlayRemoveTime: 2000 };

//    map.addControl(new DragZoomControl(boxStyleOpts, otherOpts, {}),new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(27,7)));
//    map.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7,32)));
   
    geocoder = new GClientGeocoder();
  }
}
function showAddress(address)
{

    if (geocoder && address!='') 
    {
        geocoder.getLatLng(address,
            function(point) 
            {
                if (!point) 
                {
                    alert(address+ ' not found.');
                } 
                else 
                {
                    map.setCenter(point);
                    marker = new GMarker(point);
                    map.addOverlay(marker);
                }
            }
        );
    }
    else
    {
        if(address=='')
        {
            alert('Please enter address');
        }
    }
}
function searchAddress(address)
{
    
    initialize();    
    showAddress(address);
}
function searchAddress1(address)
{
    
    initialize();    
    showAddress(address);
}
function ZoomIn()
{
    if(map!=null)
        map.zoomIn()
}
function ZoomOut()
{
    if(map!=null)
        map.zoomOut()
}

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.