jmelosegui / GooglemapMvc

The control wraps Google maps API simplifying the use of Google maps in ASP.NET MVC applications.
MIT License
116 stars 61 forks source link

Add html to infowindow using BindTo #155

Closed ivanteles closed 2 years ago

ivanteles commented 6 years ago

Not working

mappings.For<Estabelecimento>(binding => binding.ItemDataBound((marker, obj) =>
                                  {
                                      marker.Latitude = double.Parse(obj.Latitude);
                                      marker.Longitude = double.Parse(obj.Logitude);
                                      marker.Title = obj.Nome;
                                      marker.ZIndex = 2;
                                      marker.Window = new InfoWindow(marker)
                                      {
                                          Template =
                                          {
                                              Content = () => ViewContext.Writer.Write($"<strong>{obj.Nome}</strong>")
                                          },
                                      };
                                  })
jmelosegui commented 2 years ago

Just updated to .net6

the following code should work.

mappings.For<Estabelecimento>(binding => binding.ItemDataBound((marker, obj) =>
                                  {
                                      marker.Latitude = double.Parse(obj.Latitude);
                                      marker.Longitude = double.Parse(obj.Logitude);
                                      marker.Title = obj.Nome;
                                      marker.ZIndex = 2;
                                      marker.Window = new InfoWindow(marker)
                                      {
                                          Template =
                                          {
                                              Html = $"<strong>{obj.Nome}</strong>"
                                          },
                                      };
                                  })

Please try that and reopen this issue if it does not work