Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6780843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:33:14+00:00 2026-05-26T16:33:14+00:00

Experts ! i am very new to XML. However, a webapp collects data in

  • 0

Experts !
i am very new to XML. However, a webapp collects data in XML form and i have to display it (and enable edit) in an ASP.Net GridView. i need your help, please.

<?xml version="1.0"?>
<Answers>
  <AnswerSet>
<Answer questionId="MRN">4444</Answer>
<Answer questionId="FName">test</Answer>
<Answer questionId="LName">patient</Answer>
<Answer questionId="AddressPt">blah blah</Answer>
<Answer questionId="Governorate">xxxx</Answer>
<Answer questionId="InitialCSF">Negative</Answer>
<Answer questionId="Diagnosis"></Answer>
<Answer questionId="Description">
</Answer>
  </AnswerSet>
  <AnswerSet>
<Answer questionId="MRN">1</Answer>
<Answer questionId="FName">1</Answer>
<Answer questionId="LName">1</Answer>
<Answer questionId="AddressPt">1</Answer>
<Answer questionId="InitialCSF">Positive</Answer>
<Answer questionId="Diagnosis">dx</Answer>
<Answer questionId="Description">
</Answer>
  </AnswerSet>
 </Answers>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:33:15+00:00Added an answer on May 26, 2026 at 4:33 pm

    Easiest way I can think of to bind the XML to a gridview is to to load the xml to a DataSet and then bind the DataSet to the gridview:

    StringReader sr= new StringReader(xml); 
    DataSet ds = new DataSet();
    ds.ReadXml(sr);
    
    Gridview.DataSource=ds.Tables[1];
    Gridview.DataBind();
    

    Reason for doing ds.Tables[0] is that your example contains 2 sets of Answers and when you load the DataSet with your XML, the first DataTable will contain as many rows as sets of answers you have on your XML while the second table will contain all the rows from all the set of answers.

    The way LinqPad displays it is as follows:

    enter image description here

    UPDATE:

    string xml=@"<?xml version=""1.0""?>
    <Answers>
      <AnswerSet>
    <Answer questionId=""MRN"">4444</Answer>
    <Answer questionId=""FName"">test</Answer>
    <Answer questionId=""LName"">patient</Answer>
    <Answer questionId=""AddressPt"">blah blah</Answer>
    <Answer questionId=""Governorate"">xxxx</Answer>
    <Answer questionId=""InitialCSF"">Negative</Answer>
    <Answer questionId=""Diagnosis""></Answer>
    <Answer questionId=""Description"">
    </Answer>
      </AnswerSet>
      <AnswerSet>
    <Answer questionId=""MRN"">1</Answer>
    <Answer questionId=""FName"">1</Answer>
    <Answer questionId=""LName"">1</Answer>
    <Answer questionId=""AddressPt"">1</Answer>
    <Answer questionId=""InitialCSF"">Positive</Answer>
    <Answer questionId=""Diagnosis"">dx</Answer>
    <Answer questionId=""Description"">
    </Answer>
      </AnswerSet>
     </Answers>";
    StringReader sr= new StringReader(xml); 
     DataSet ds = new DataSet();
     ds.ReadXml(sr);
     ds.Merge(ds,true);
     gridview.DataSoure=ds.Tables[1];
         gridview.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As I am new to asp.net mvc I would like to get the list
My teammates and I have a very challenging new project to do, and we
I have a piece of data. At the moment, it's an XML file, but
I have a Gtk::HBox which should contain two elements only. However, the constructor new
I'm very keen to learn Iphone apps development. Can you experts give me some
Experts - I need some advice in the following scenario. I have a configuration
SQL Experts, Is there an efficient way to group runs of data together using
Dear experts, I am quite new to javascript and I often see coders use
Question for YUI experts... I have a table and I've made each cell of
I'm very new to python. two days. trying to get a plot working with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.