Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is my first .xml file. I want convert that .xml file data into gridview.
Thanks in advance.

XML
  <?xml version="1.0" encoding="utf-8" ?>
- <CDR>
- <Application>
  <CALL_TYPE Value="OUTGOING" />
  <CARRIER_TRUNK Value="701" />
  <DOD_GROUP Value="095" />
  </Application>
- <Time>
  <CDR_START_TIME Value="1-06-2013 9:12:10" />
  <ANSWER_TIME Value="1-06-2013 9:12:33" />
  <CDR_END_TIME Value="1-06-2013 9:12:40" />
  </Time>
- <Number>
  <CALLER_PARTY_NUMBER Value="200" />
  <CALL_TERMINATING_PARTY_NUMBER Value="200" />
  <DIALED_NUMBER Value="0252059" />
  <CALLED_PARTY_NUMBER Value="252039" />
  </Number>
  </CDR>
Posted
Updated 9-Nov-15 22:44pm
v2

1 solution

please follow the following procedure will bind xml data into gridview.

1. To load xml string into dataset.

2. you will get three tables on same dataset.

3. use sample code will bind the gridview.

CDR_Gridview.datasource = dataset_CDR.Tables[0]; // or use dataset_CDR.Tables["Application"]
CDR_Gridview.databind();

CDR_Gridview.datasource = dataset_CDR.Tables[1]; // or use dataset_CDR.Tables["Time"]
CDR_Gridview.databind();

CDR_Gridview.datasource = dataset_CDR.Tables[2]; // or use dataset_CDR.Tables["Number"]
CDR_Gridview.databind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900