我已将图片名称加载到 aspx 上的数据表中,但这是将它们放在页面上的最佳方式....
private void LoadPics()
{
Image1.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[0]["name"].ToString();
Label1.Text = MyClass.dtprop.Rows[0]["name"].ToString();
Image2.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[1]["name"].ToString();
Label2.Text = MyClass.dtprop.Rows[1]["name"].ToString();
Image3.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[2]["name"].ToString();
Label3.Text = MyClass.dtprop.Rows[2]["name"].ToString();
Image4.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[3]["name"].ToString();
Label4.Text = MyClass.dtprop.Rows[3]["name"].ToString();
Image5.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[4]["name"].ToString();
Label5.Text = MyClass.dtprop.Rows[4]["name"].ToString();
Image6.ImageUrl = @"~\Pictures\" + MyClass.dtprop.Rows[5]["name"].ToString();
Label6.Text = MyClass.dtprop.Rows[5]["name"].ToString();
}