Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Display data on mouseover in google map

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 30
    Comment on it

    While integrating the google maps into your project you need to display it using the customized events and customize data which is based on the requirement.

     

     

     

    (function (marker, data) {
    
        // Attaching a click event to the current marker
        google.maps.event.addListener(marker, "click", function (e) {
            infoWindow.setContent(data.description);
            infowindow.open(map, marker);
        });
    
    
        google.maps.event.addListener(marker, "mouseover", function (e) {
            infoWindow.setContent(data.description);
            infowindow.open(map, marker);
        });
    
    
    
    })(marker, data);
    
    
    }

     

    So for doing that we need to do that according to the user data available into the datasource.

     

     

    public string ConvertDataTabletoString()
        {
            DataTable dt = new DataTable();
            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("select title=Company,lat=latitude,lng=longitude,image from MapDimension", con))
                {
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.Fill(dt);
                    System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                    List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
                    Dictionary<string, object> row;
                    foreach (DataRow dr in dt.Rows)
                    {
                        row = new Dictionary<string, object>();
                        foreach (DataColumn col in dt.Columns)
                        {
                            row.Add(col.ColumnName, dr[col]);
                        }
                        rows.Add(row);
                    }
                    return serializer.Serialize(rows);
                }
            }

     

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: