A
André Freitas
Im using:
XDocument xDocument = XDocument.Load("somexml");
var linq =
from itens in
xDocument.Root.Elements("channel").Elements("item").Take(10)
select new
{
title = (string)itens.Element("title"),
link = (string)itens.Element("link")
};
rptBlogFeed.DataSource = linq;
rptBlogFeed.DataBind();
I do need to handle the Repeater_ItemDataBound, and im doing:
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item)
{
DataRow dataRow = (DataRow)e.Item.DataItem;
HyperLink hyperLink = (HyperLink)e.Item.FindControl("hlkBlog");
hyperLink.Text = dataRow["title"].ToString();
hyperLink.NavigateUrl = dataRow["link"].ToString();
//some other things, dont matter at all
}
}
Off course, im getting a error (var types):
impossible to convert
<>f__AnonymousType0`2[System.String,System.String]' to
'System.Data.DataRow'
How can I do that?
XDocument xDocument = XDocument.Load("somexml");
var linq =
from itens in
xDocument.Root.Elements("channel").Elements("item").Take(10)
select new
{
title = (string)itens.Element("title"),
link = (string)itens.Element("link")
};
rptBlogFeed.DataSource = linq;
rptBlogFeed.DataBind();
I do need to handle the Repeater_ItemDataBound, and im doing:
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs
e)
{
if (e.Item.ItemType == ListItemType.Item)
{
DataRow dataRow = (DataRow)e.Item.DataItem;
HyperLink hyperLink = (HyperLink)e.Item.FindControl("hlkBlog");
hyperLink.Text = dataRow["title"].ToString();
hyperLink.NavigateUrl = dataRow["link"].ToString();
//some other things, dont matter at all
}
}
Off course, im getting a error (var types):
impossible to convert
<>f__AnonymousType0`2[System.String,System.String]' to
'System.Data.DataRow'
How can I do that?