LINQ to XML 和 GridView.ImageField
我想知道如何根据 xml 文档中的 imageurl 将图像添加到 gridview 中。到目前为止,我...
XDocument xmlDoc = XDocument.Load(Server.MapPath("XMLFile.xml"));
var q = from c in xmlDoc.Descendants("Images")
where c.Element("PropertyId").Value.ToString() == DropDownList1.SelectedValue.ToString()
select new
{
Id = c.Element("PropertyId").Value,
Thumb = c.Element("ThumbUrl").Value
};
GridView1.DataSource = q;
GridView1.DataBind();
它可以很好地在拇指字段中显示 url,但不是显示这个,我如何将其更改为图像字段?
i am wanting to know how to add an image to a gridview based on the imageurl in a xml document. so far i have...
XDocument xmlDoc = XDocument.Load(Server.MapPath("XMLFile.xml"));
var q = from c in xmlDoc.Descendants("Images")
where c.Element("PropertyId").Value.ToString() == DropDownList1.SelectedValue.ToString()
select new
{
Id = c.Element("PropertyId").Value,
Thumb = c.Element("ThumbUrl").Value
};
GridView1.DataSource = q;
GridView1.DataBind();
which works fine to show the url in the thumb field but instead of showing this how do i change it an image field?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标记:
代码隐藏:
您的问题是什么?
Markup:
Code-behind:
What is your problem?