Hello all. I am new to ASP.NET XML so I am looking for some guidance. I have an XML string that needs to read into an ASP.NET C# Gridview. The XML data actually comes from the CRM SDK crm web service (FetchXML). The XML Elements contain (dots) and attributes which seem to be the issue here. If I do a Replace on the XML and remove the DOT, I still cannot read the entire XML string into Gridview because there is an attribute with that element. (notice the ppl.amount)
Here is the XML output that was generated from FetchXML:
Device with Standard Service for Warranty!--removed tag-->
Device with Standard Service for Warranty!--removed tag-->
{245798D8-0660-DE11-8B1F-00237D653ED0}!--removed tag-->
{C9D286D4-AE18-DE11-8153-00237D653ED0}!--removed tag-->
20!--removed tag-->
!--removed tag-->
RF Remote!--removed tag-->
RF Remote!--removed tag-->
{BF107F7D-A461-DE11-8B1F-00237D653ED0}!--removed tag-->
{C9D286D4-AE18-DE11-8153-00237D653ED0}!--removed tag-->
25!--removed tag-->
!--removed tag-->
!--removed tag-->
I need some code that would read this XML properly into a dataset that I can assign to the Gridview datasource.
Here is the code I am using now:
DataSet ds = new DataSet();
result1 = MY XML STRING FROM FETCHXML
StringReader rdr;
rdr = new StringReader(result1);
ds.ReadXml(rdr);
GridView1.DataSource = ds.Tables[1];
GridView1.DataBind();
If I don't set AutoGenerateColumns="false" in the Gridview, it does not display the "ppl.amount" element or the ppl.transactioncurrencyid element. I need those two columns to show in the Gridview as well.
Can someone help me get this figured out please??
Thanks a lot!
!--removed tag-->
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).