2017-11-16 11 views
0

今私が知りたいのは、画像を剃刀ビューの「img src」にバインドする方法だけです。他の質問は検索しましたが、 "〜/ Images /"はアップロードされた画像があるフォルダです。剃刀の画像を<img src>のループにバインドする

@model List<propertyMgmt.Models.Property> 
    <div id="propertyList"> 
      <label>Select properties to be Featured:</label><br /> 
      <table class="table"> 
      <tr> 
       <th> 
       @Html.Label("Property Description") 
       </th> 
       <th> 
       @Html.Label("Property Cost") 
       </th> 
       <th> 
       @Html.Label("Property Image") 
       </th> 
       <th> 
       @Html.Label("Featured??") 
       </th> 
      </tr> 
      @for (int i=0;i<Model.Count;i++) 
      { 
      <tr> 
       <td> 
       @Html.DisplayFor(m => m[i].PropertyDescription) 
       </td> 
       <td> 
       @Html.DisplayFor(m => m[i].PropertyCost) 
       </td> 
       <td> 
       <img src="~/Images/@(m=>m[i].PropertyImage)" /> 
       </td> 
       <td> 
       @Html.CheckBoxFor(m => m[i].IsFeatured, new { 
       @onclick = "propertyCheckBoxSelect(this)" }) 
       </td> 
      </tr> 
      } 
      </table> 
     </div> 
+2

'@Model [i] .PropertyImage' – DavidG

+0

Thank You David !! :) –

答えて

0

このように使用できます。

<img src="~/Images/@(Model[i].PropertyImage)" /> 
+0

ありがとうNitesh :) –

関連する問題