2016-03-23 27 views
-1

我有一些Razor代碼來獲取地圖的細節,然後將這些數據傳遞給Javascript代碼。所有預期的作品,但然後我需要在infoWindow裏面添加圖像,到目前爲止它只是將其顯示爲文本。我的代碼使用Razor和JS在信息窗口中嵌入圖像

@inherits umbraco.MacroEngines.DynamicNodeContext 
<script type="text/javascript"> 

var MapLocations = [ 
@if (Model.Children.Where("Visible").Any()) 
{ 
    var naviLevel = Model.Children.Where("Visible").First().Level; 

     foreach (var childPage in Model.Children.Where("Visible")) 
     { 
      var LatLng = @childPage.LatLng; 
      var LocationName = @childPage.CustomerName; 
      var Image = "<img src=\"" + @Model.MediaById(@childPage.image).umbracoFile + "\" alt=\"Alt text\" height=\"115\" width=\"83\">"; 

      <text>['@LatLng' + @LocationName + '@Image'],</text> 
     } 
} 
    ]; 

我怎麼能添加圖像信息窗口內,並確保它不顯示爲文本,但呈現的形象呢?

+0

這將是很高興知道哪個小丑添加downvote沒有解釋! – Computer

回答

1

您可以輸出像@ Html.Raw(...),而不是?