3

I have 1000 markers displayed on map which are retrieved from datagridview. Thats working fine but I want to display text as client name on these markers when clicked. is it possible to do that....

if (comboBox5.SelectedIndex == 4)//(REGION 1) {

            gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; ;

            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
            GMapOverlay markersOverlay = new GMapOverlay("VCS MAP");
            gMapControl1.MaxZoom = 11;
            gMapControl1.MinZoom = 1;
            gMapControl1.Zoom = 1;
            SqlDataReader myReader;
            String Query = " SELECT  top 200 Latitude,Longitude,client name  FROM [ICPS].[dbo].[agreement latlongkir]   where region ='5' ";
            SqlConnection conDataBase = new SqlConnection(conString);
            conDataBase.Open();
            SqlCommand cmdDatabase = new SqlCommand(Query, conDataBase);
            myReader = cmdDatabase.ExecuteReader();
            gMapControl1.HoldInvalidation = true;



            while (myReader.Read())
            {
                string Latitude = myReader["Latitude"].ToString();
                string Longitude = myReader["Longitude"].ToString();
                string ClientName = myReader["client name"].ToString();
                gMapControl1.Position = new PointLatLng(float.Parse(Latitude), float.Parse(Longitude));
                GMarkerGoogle marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.pink);
                markersOverlay.Markers.Add(marker);
                gMapControl1.Overlays.Add(markersOverlay);
                marker.ToolTip = new GMapRoundedToolTip(marker);
                marker.ToolTipText = myReader("ClientName");


            }
        }
kiran v
  • 137
  • 1
  • 4
  • 13
  • Did you check this [Making a Google Maps marker show a specific div when clicked](http://stackoverflow.com/questions/14387767/making-a-google-maps-marker-show-a-specific-div-when-clicked) – sohaiby Jul 12 '13 at 12:05

1 Answers1

2

Looks like your missing this. I have implemented something similar with no issue. I have some working code you can take a look at if this doesnt help.

marker.ToolTipMode = MarkerTooltipMode.Always;
Nate S.
  • 1,117
  • 15
  • 31