2011-04-29 46 views
0

在這個項目中我試圖執行一個價格表(這是一個動物標本網站)因此,這裏就是我要做的事情,告訴你的代碼圖片被顯示爲奇怪的字符

PriceListController

public partial class PriceListController : Controller 
    { 

     public PriceListController() 
     { 
     } 


     [CanonicalUrlAttribute("PriceList")] 
     [CompressionFilter(Order = 1)] 
     [CacheFilter(Duration = 120, Order = 1)] 
     public virtual ActionResult Index() 
     { 
      GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities(); 
      var viewModel = new PriceListViewModel() { PriceListAnimals = context.GetAnimalListForPriceList() }; 
      return View(viewModel); 
     } 


     [CompressionFilter(Order = 1)] 
     [CacheFilter(Duration = 120, Order = 2)] 
     public virtual ActionResult List(string animal) 
     { 
      GodsCreationTaxidermyEntities context = new GodsCreationTaxidermyEntities(); 

      var viewModel = new PriceListIndexViewModel() { AnimalPrices = context.GetPriceListByAnimal(animal) }; 
      return View(viewModel); 
     } 

    } 

索引工作正常。這裏的Index.aspx的

的Index.aspx

<div id="main-content" title="AnimalBox" style="float:none;"> 
    <%--<%= Html.DropDownList("AnimalList", Model.Animals, "[Select One]", new { @class = "inputDropDown" })%>--%> 
    <% Html.DataList(Model.PriceListAnimals).Columns(6).Item(item => 
{ 
    item.Template(galleryImage => 
    {%> 
     <div style="margin-right:45px; line-height:150%;"> 
      <span><%= Html.ActionLink(galleryImage.AnimalName,"List",new { @animal = galleryImage.AnimalName }) %></span> 
     </div> 

     <% }); 

}).Render(); %> 
</div> 

現在我們移動到列表頁面

List.aspx

<div class="maintext" id="pricelist"> 
     <h2 class="sectionHeader">:: Gods Creation Taxidermy : PriceList ::</h2> 
      <% Html.DataList(Model.AnimalPrices).Columns(7).Item(item => 
      { 
       item.Template(galleryImage => 
      {%>     
        <div><%=galleryImage.TypeName %></div>         
     <%}); 

    }).Render(); %> 
     <% Html.DataList(Model.AnimalPrices).Columns(7).Item(item2 => 
     { 
      item2.Template(galleryImage => 
     {%> 

       <div><%=galleryImage.MountPrice %></div> 

     <% }); 

     }).Render(); %> 
    </div> 

這裏有一個如何這個截圖beeing顯示

Screenshot

如果有人認爲我肯定會感激。

編輯:順便說一下,圖像arent被存儲在數據庫中,只是路徑,這使得這更加fonfusing。

回答

0

這個問題已解決,我有幾件事倒退