Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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
Updated 12-Aug-12 5:35am
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900