我知道我错过了一些东西,但我有限的经验阻碍了我。有什么建议吗?谢谢你的帮助!
页面代码:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:Image runat="server" ID="image1" ImageUrl="<%# DataBinder.Eval(Container.DataItem, "url") %>" />
</ItemTemplate>
</asp:Repeater>
后面的代码:
protected void Page_Load(object sender, EventArgs e)
{
var dt = new DataTable("images");
dt.Columns.Add("url");
dt.Rows.Add("http://www.boeing.com/assets/images/defense-space/military/p8a/images/P8-A_index.jpg");
dt.Rows.Add("http://www.tractorbynet.com/forums/attachments/power-trac/258427d1333048884-p-8-replacing-p3c-p-8a_mma_changed_wing_lg.jpg");
var ds = new DataSet();
ds.Tables.Add(dt);
Repeater1.DataSource = ds.Tables[0];
Repeater1.DataBind();
}
错误: