Click here to Skip to main content
Sign Up to vote bad
good
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:05
mzkotku308
Edited 12 Aug '12 - 5:35


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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 206
1 Richard MacCutchan 145
2 Tadit Dash 140
3 Sergey Alexandrovich Kryukov 135
4 Santhosh G_ 125
0 Sergey Alexandrovich Kryukov 10,294
1 OriginalGriff 7,955
2 CPallini 4,201
3 Rohan Leuva 3,522
4 Maciej Los 3,159


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 12 Aug 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid