views:

87

answers:

0

I have a pretty simple operation but am struggling with how to implement it.

I am loading XML from an external data source using a DataSet.ReadXml(), then creating a new XMLDataDocument from that data set, then syncing the Dataset with updated data from the XMLDataDocument like so:

doc = new XmlDataDocument(dsDataSet);
dsDataSet.EnforceConstraints = false;
dsDataSet= doc.DataSet; 

Once loaded I do two things to the XmlDataDocument:

Loop through and check if

  • a purely meta node, count, exists right beneath the root node and if so remove it.
  • a thumb node exists in a second level nodelist "list" and if not, create and append it.

This is all going a expected because the resulting XML from doc.save() looks correct and my output does not throw any error resulting from the count node being present (which it used to do).

Where I'm having an issue is updating the Dataset with the appended thumb element. This dataset is being applied as the data source for an ASP DataGrid. Once all the above XML manipulation is done I do this:

dsDataSet.Merge(doc.DataSet);
dsDataSet.AcceptChanges();

I then apply the data set to the grid control:

dgList.DataSource = dsDataSet;
dgList.DataMember = "list";
dgList.DataBind();

But, when I do this I get this error on the site:

System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'thumb'.

It doesn't look like the new "thumb" element is every being recognized by the DataSet. What did I miss?