I want to bind Repeater control to Dataset which is filled with XML data, but i don't know how to show attributes inside repeater.
Xml File:
<root> <items> <item id="9" name="111111111111" description="111111245" views="1" galleryID="0" /> </items></root>
<asp:Repeater ID="rptrGalleries" runat="server"> <ItemTemplate> <a href='Page?id=<%#DataBinder.Eval(Container.DataItem, "id") %>'><%#DataBinder.Eval(Container.DataItem, "name") %></a> </ItemTemplate></asp:Repeater>
XDocument doc = XDocument.Load(Server.MapPath("~/xml/gallery.xml")); IEnumerable<XElement> items = from item in doc.Descendants("item") where int.Parse(item.Attribute("galleryID").Value) == 0 select item; DataSet ds = new DataSet(); ds.ReadXml(new StringReader(doc.ToString())); rptrGalleries.DataSource = ds; rptrGalleries.DataBind();
System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'id'.