Hi
I am trying to bind a chart to a Xml Document object but have been unable to get it working successfully.
I am following the example in the documentation for binding to an Xml file and this is working without problem.
However if I attempt to bind to an XML document I am getting the following error "Column 'IsEmpty' does not belong to table".
I am using the following code to build the Xml document:
Any suggestions as to what is going wrong?
Thanks
Colin
I am trying to bind a chart to a Xml Document object but have been unable to get it working successfully.
I am following the example in the documentation for binding to an Xml file and this is working without problem.
RadChart1.DataSource = Server.MapPath("~/Products.xml"); |
RadChart1.Series[0].DataYColumn = "QuantityInStock"; |
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"; |
RadChart1.DataBind(); |
However if I attempt to bind to an XML document I am getting the following error "Column 'IsEmpty' does not belong to table".
I am using the following code to build the Xml document:
StringBuilder sb = new StringBuilder(); |
StringWriter sw = new StringWriter(sb); |
XmlTextWriter writer = new XmlTextWriter(sw); |
writer.Formatting = Formatting.Indented; |
writer.WriteStartDocument(); |
writer.WriteStartElement("Products", null); |
writer.WriteStartElement("Product", null); |
writer.WriteAttributeString("Name", "Parka L"); |
writer.WriteAttributeString("QuantityInStock", "123"); |
writer.WriteEndElement(); |
writer.WriteStartElement("Product", null); |
writer.WriteAttributeString("Name", "Parka M"); |
writer.WriteAttributeString("QuantityInStock", "56"); |
writer.WriteEndElement(); |
writer.WriteStartElement("Product", null); |
writer.WriteAttributeString("Name", "Parka S"); |
writer.WriteAttributeString("QuantityInStock", "92"); |
writer.WriteEndElement(); |
writer.WriteStartElement("Product", null); |
writer.WriteAttributeString("Name", "Mittens"); |
writer.WriteAttributeString("QuantityInStock", "12"); |
writer.WriteEndElement(); |
writer.WriteEndElement(); |
writer.Flush(); |
XmlDocument xmlDocs = new XmlDocument(); |
xmlDocs.LoadXml(sb.ToString()); |
RadChart1.DataSource = xmlDocs; |
RadChart1.Series[0].DataYColumn = "QuantityInStock"; |
RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"; |
RadChart1.DataBind(); |
Any suggestions as to what is going wrong?
Thanks
Colin