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 6222717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:21:46+00:00 2026-05-24T08:21:46+00:00

I am trying to format XML data to display on a grid. Page1.aspx. This

  • 0

I am trying to format XML data to display on a grid.

Page1.aspx. This inserts XML data stored a xmldatatype:

WorkHistory workhis = js.Deserialize<WorkHistory>(json);
XmlDocument work = (XmlDocument)JsonConvert.DeserializeXmlNode(json, "root");                
objBLL.insert_XMLWork(work, Convert.ToInt64(ui.id));

Page2.aspx retrieves it and display on a grid:

DataTable FBWorkDt = objBLL.get_FacebookWork(FacebookUserId);
GrdWork.DataSource = FBWorkDt;
GrdWorkPub.DataBind();        
get_FacebookWork(select workinfo from Fprofiles where Userid = FacebookUserId)

returns a DataTable

It displays in this format exactly.

WorkInfo
<root><work><employer><id>208571635850052</id><name>Netizen Apps</name></employer></work><id>1076483621</id></root>

How do I make a normal display instead of XML format?

Thanks
Sun

  • 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-24T08:21:47+00:00Added an answer on May 24, 2026 at 8:21 am

    It depends a good deal on the shape of the DataTable you’re returning, but assuming you want the display to be something like this:

    `ID Name

    ——————– ———————

    208571635850052 Netizen Apps`

    You could use LINQ:

    DataTable FBWorkDt = objBLL.get_FacebookWork(FacebookUserId);
    var query = from x in FBWorkDt.AsEnumerable()
                select new {
                        id = x.ID,
                        name = x.Name
                };
    GrdWork.DataSource = query.ToList();
    GrdWorkPub.DataBind(); 
    

    I haven’t tried the code out, so there may be minor syntatic changes, but essentially what it’s doing is:

    1. Use LINQ to get a collection of a new anonymous type that has one entry per row with the id and name from the table. You have to use AsEnumerable() [contained in System.Data.DataSetExtensions].
    2. Convert the LINQ result set to a List via .ToList() and bind it to the GridView.

    If you can post a little more information – what exactly you mean by display, and the expected shape of the returned DataTable (i.e., what the columns in each row are) we can give you a better answer.

    UPDATE
    If you’re storing the XML document above in your datastore and that is being returned in the table, try this code:

    DataTable FBWorkDt = objBLL.get_FacebookWork(FacebookUserId);
    XDocument xDoc = XDocument.Load(FBWorkDt.Rows[0][0].ToString());
    
    var query = from x in xDoc.Descendants("employer")
                select new 
                {
                    id = (string)x.Element("id"),
                    name = (string)x.Element("name")
                }
    GrdWork.DataSource = query.ToList();
    GrdWorkPub.DataBind(); 
    

    Same basic principal as above, except this time your querying over an XDocument instead of a DataTable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a generic PL/SQL procedure to export data in specific XML format,
I'm trying to format a table from XML. Lets say I have this line
I am trying to parse some currency data in xml format. Below code does
I am trying to pass data from the database in XML format to an
I'm trying to output an XLS file in the XML format. This is what
I'm trying to transform one XML format to another using XSL. Try as I
I'm trying to generate a RDoc using the XML format. Here's the command that
I'm trying to convert a xml document from one format to another and while
I am trying to change an XML file from one format to another and
I'm trying to import an XML that's provided by twitter into a readable format

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.