Can you show me how to call BondAmount in ?
I basically want to get the list of bond amount so i will be



Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
        private void button1_Click(object sender, EventArgs e)

            XDocument d = XDocument.Load("XMLFile1.xml");

            var amounts = d.Descendants( "BondAmount" );

            foreach ( var amount in amounts)

Open in new window

Make sure to select XMLFile1.xml in the Solution Explorer and hit F4 to change its Copy to Output Directory property to "Copy always"
Mike EghtebasDatabase and Application DeveloperCommented:
I tested the solution, I got:
I realize that you are using asp but the looping code is the same, In place of MessageBox( user Response.Write(
Mike EghtebasDatabase and Application DeveloperCommented:
Here is asp version:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    protected void Button1_Click(object sender, EventArgs e)
        XDocument d = XDocument.Load("C:\\Users\\Mike\\Documents\\EE\\WebSite5\\XMLFile.xml");

        var amounts = d.Descendants("BondAmount");

        foreach (var amount in amounts)
            Response.Write(amount.Value.ToString() + "\n");
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Mike EghtebasDatabase and Application DeveloperCommented:
asp outputHere is asp output:
ITsolutionWizardAuthor Commented:
actually i forgot something i want to use gridview and xmldatasource. sorry my bad.
can you show me how? thanks
Mike EghtebasDatabase and Application DeveloperCommented:
That is okay, you can always post a new question. But close this one because the content needs to match the original post. Even after the gridview question, there will be many other questions coming.

Mean while I prepare the groundwork for your new question.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITsolutionWizardAuthor Commented:
no problem. I will post it soon. thank you for your helps.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.