Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Google-Maps
string dosya_adres = @"C:\Users\...\Desktop\exam.xls";
    OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dosya_adres + ";Extended Properties=Excel 8.0");
    baglanti.Open();
    string query = "select * from [Sayfa1$] ";
    OleDbDataAdapter oAdp = new OleDbDataAdapter(query, baglanti);
     DataTable tbl = new DataTable();
    oAdp.Fill(tbl);
    //GridView1.DataSource = tbl;
    //GridView1.DataBind();
    row = tbl.Rows.Count;
 
    int i = 0;
   String Locations = "";
   foreach (DataRow r in tbl.Rows)
    {
      // bypass empty rows 
       if (r["Latitude"].ToString().Trim().Length == 0)
           continue;
 
         string Latitude = r["Latitude"].ToString();
         string Longitude = r["Longitude"].ToString();
       
       
 
      // create a line of JavaScript for marker on map for this record 
         Locations += Environment.NewLine + "var marker" + i.ToString() + @" = new google.maps.Marker({
        position: new google.maps.LatLng
        (" + Latitude + ", " + Longitude + @"),
        map: map
        });";
        i++;
   }
 
                  // construct the final script
      js.Text = @"<script type='text/javascript'>
                  var latlng = new google.maps.LatLng(37.8666667, 32.4833333);
                  var myOptions = { zoom: 13, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
                  function initialize() {
                  
                  var map = new google.maps.Map(document.getElementById('mapdiv'), myOptions);
                  " + Locations + @"
                   }
             </script> ";
map is work but ı cant adding markers please help
Posted 12-Aug-12 5:05am
mzkotku308
Edited 12-Aug-12 5:35am
(no name)82.2K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,656
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,240
3 George Jonsson 3,584
4 Gihan Liyanage 2,625


Advertise | Privacy | Mobile
Web01 | 2.8.140921.1 | Last Updated 12 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100