图像显示为奇怪的字符

时间:2011-04-29 05:20:07

标签: asp.net-mvc-2

在这个项目中,我正在尝试实施一个价目表(它是一个动物标本制作网站)所以这就是我要做的,给你看代码

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>

以下是如何显示

的屏幕截图

Screenshot

如果有人跟他说话,我肯定会有机会。

编辑:顺便说一下,图像不是存储在数据库中的,只是路径,这使得它更加迷人。

1 个答案:

答案 0 :(得分:0)

这个问题已经解决,我有几件事情倒退