Last post Aug 31, 2011 11:00 PM by Decker Dong - MSFT
Member
9 Points
50 Posts
Aug 30, 2011 01:34 PM|kailin75|LINK
Hi ASP.net and XML gurus,
Thank you in advance for your help.
I'm using a GridView control. If I set the DataSource to the following XML, and then DataBind, the XML is displayed on my web page in my GridView control correctly:
<?xml version="1.0" encoding="UTF-8"?> <countries> <country> <text>Norway</text> <value>N</value> </country> <country> <text>Sweden</text> <value>S</value> </country> <country> <text>France</text> <value>F</value> </country> <country> <text>Italy</text> <value>I</value> </country> </countries>
However, if I add standard SOAP markup/elements like the following, nothing is displayed in my GridView control and my web page is blank.
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <countries> <country> <text>Norway</text> <value>N</value> </country> <country> <text>Sweden</text> <value>S</value> </country> <country> <text>France</text> <value>F</value> </country> <country> <text>Italy</text> <value>I</value> </country> </countries> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Do you have any idea why this happens? Thank you in advance for your help.
Thanks,
Kailin.
All-Star
94120 Points
18111 Posts
Aug 31, 2011 11:00 PM|Decker Dong - MSFT|LINK
Hello kailin75,
Bind your GridView with "result" below:
public class MyClass{ public static void Main() { var result = from e in XDocument.Load("XMLFile1.xml").Descendants("country") select new { Text = e.Element("text").Value, Value = e.Element("value").Value }; //This is only a test.... foreach (var item in result) { Console.WriteLine(item.Text+"===="+item.Value); } }}
Member
9 Points
50 Posts
DataBind fails when soap elements added
Aug 30, 2011 01:34 PM|kailin75|LINK
Hi ASP.net and XML gurus,
Thank you in advance for your help.
I'm using a GridView control. If I set the DataSource to the following XML, and then DataBind, the XML is displayed on my web page in my GridView control correctly:
However, if I add standard SOAP markup/elements like the following, nothing is displayed in my GridView control and my web page is blank.
Do you have any idea why this happens? Thank you in advance for your help.
Thanks,
Kailin.
All-Star
94120 Points
18111 Posts
Re: DataBind fails when soap elements added
Aug 31, 2011 11:00 PM|Decker Dong - MSFT|LINK
Hello kailin75,
Bind your GridView with "result" below: