0
我有自定义列表中有图像字段。我必须通过对象建模代码来显示图像。图像自定义网页
哪个控件我需要用来在webpart中显示图像以及我需要为其指定哪个属性。
[Guid("207cea76-b1ee-4b86-9638-00c22d3d9398")]
public class News : System.Web.UI.WebControls.WebParts.WebPart
{
Label lblTitle;
ImageField imgNews;
Label lblDescription;
public News()
{
}
protected override void CreateChildControls()
{
base.CreateChildControls();
lblTitle = new Label();
imgNews = new ImageField();
lblDescription = new Label();
string siteURL = "http://my-dev-box-har";
using (SPSite site = new SPSite(siteURL))
{
using (SPWeb web = site.OpenWeb())
{
SPListItemCollection list = web.Lists["News"].Items ;
foreach (SPListItem item in list)
{
lblTitle.Text = item["Title"].ToString();
lblDescription.Text = item["Description"].ToString();
imgNews. = item[""].ToString();
Controls.Add(lblTitle);
Controls.Add(lblDescription);
}
}
}
}
}
}
我不知道wheather使用图像或ImageField的控件来显示我的形象形成的SharePoint自定义列表。
有人可以指点我正确的方向请。
谢谢 哈日