This is a migrated thread and some comments may be shown as answers.

[Solved] Bind GridView

0 Answers 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chirag
Top achievements
Rank 1
Chirag asked on 31 Aug 2011, 09:11 AM
hi to all 
i have one wcf service 
in service 

string xmlString;
System.Xml.Serialization.XmlSerializer oSerializer = new System.Xml.Serialization.XmlSerializer(typeof(DataSet));
DataSet ds = new DataSet();
StringBuilder sb = new StringBuilder();
using
(StringWriter sw = new StringWriter(sb))
{
    oSerializer
.Serialize(sw, ds);
    xmlString
= sb.ToString();
}

this code return me a 

<?xml version="1.0" encoding="utf-16"?>
<DataSet>
 
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
   
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="">
     
<xs:complexType>
       
<xs:choice minOccurs="0" maxOccurs="unbounded">
         
<xs:element name="Table">
           
<xs:complexType>
             
<xs:sequence>
               
<xs:element name="ID" type="xs:int" minOccurs="0" />
               
<xs:element name="CheckboxCol" type="xs:int" minOccurs="0" />
               
<xs:element name="Last_x0020_Name" type="xs:string" minOccurs="0" />
               
<xs:element name="First_x0020_Name" type="xs:string" minOccurs="0" />
               
<xs:element name="User_x0020_Group" type="xs:string" minOccurs="0" />
             
</xs:sequence>
           
</xs:complexType>
         
</xs:element>
       
</xs:choice>
     
</xs:complexType>
   
</xs:element>
 
</xs:schema>
 
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
   
<NewDataSet>
     
<Table diffgr:id="Table1" msdata:rowOrder="0">
       
<ID>1</ID>
       
<CheckboxCol>0</CheckboxCol>
       
<Last_x0020_Name>patel</Last_x0020_Name>
       
<First_x0020_Name>krunal</First_x0020_Name>
     
</Table>
     
<Table diffgr:id="Table2" msdata:rowOrder="1">
       
<ID>46</ID>
       
<CheckboxCol>0</CheckboxCol>
       
<Last_x0020_Name>123</Last_x0020_Name>
       
<First_x0020_Name>123</First_x0020_Name>
       
<User_x0020_Group>123</User_x0020_Group>
     
</Table>
     
<Table diffgr:id="Table3" msdata:rowOrder="2">
       
<ID>47</ID>
       
<CheckboxCol>0</CheckboxCol>
       
<Last_x0020_Name>def</Last_x0020_Name>
       
<First_x0020_Name>abc</First_x0020_Name>
       
<User_x0020_Group />
     
</Table>
   
</NewDataSet>
 
</diffgr:diffgram>
</DataSet>

now my question is how can i bind this response in GridView  

StringReader stream = new StringReader(e.Result.ToString());
XmlReader reader = XmlReader.Create(stream);
XDocument myDoc = new XDocument();
myDoc = XDocument.Load(reader);

i am using upper code for change string response to xml



Tags
GridView
Asked by
Chirag
Top achievements
Rank 1
Share this question
or