【发布时间】:2010-11-21 13:32:02
【问题描述】:
使用 asp.net-4.0 我这样做了:
slideshow.aspx
<div class="wrapCarousel">
<div class="Carousel">
<% foreach(var image in Images) { %>
<div class="placeImages">
<img width="150px" height="150px" src="../Img/<%=image.TnImg%>" alt="<%=image.Name%>" />
<div class="imageText">
<%=image.Name%>
</div>
</div>
<% } %>
</div>
然后Images在后面的代码中是这样的 幻灯片.aspx.cs:
public class Image
{
public string TnImg { get; set; }
public string Name { get; set; }
public string City { get; set; }
public string RefPlace { get; set; }
public string RefInfo { get; set; }
public string RefInfoDynamic { get; set; }
public Image(string TnImg, string Name, string City, string RefPlace, string RefInfo, string RefInfoDynamic)
{
this.TnImg = TnImg;
this.Name = Name;
this.City = City;
this.RefPlace = RefPlace;
this.RefInfo = RefInfo;
this.RefInfoDynamic = RefInfoDynamic;
}
}
Images.Add(new Image("", "", "", "", "", "");
现在使用 asp.net-MVC2 我没有任何代码,因此我无法像以前那样访问图像,并且需要将其传递给 .aspx 文件。
这是怎么做到的?
谢谢 中号
【问题讨论】:
标签: c# asp.net-mvc-2 viewmodel