Click here to Skip to main content
11,489,549 members (75,324 online)
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 6:05am
mzkotku308
Edited 12-Aug-12 6:35am
(no name)90.4K
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 OriginalGriff 278
2 Maciej Los 180
3 _duDE_ 141
4 Frankie-C 135
0 Sergey Alexandrovich Kryukov 9,488
1 OriginalGriff 8,425
2 Sascha Lefèvre 3,344
3 Maciej Los 3,066
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 12 Aug 2012
Copyright © CodeProject, 1999-2015
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