ITsolutionWizard
asked on
asp.net xml
Can you show me how to call BondAmount in asp.net/c# ?
I basically want to get the list of bond amount so i will be
10000
15000
Thanks
<Bonds>
<Bond>
<State>CA</State>
<BondAmountListing>
<BondAmount>10000</BondAmo unt>
<BondAmount>15000</BondAmo unt>
</BondAmountListing>
/Bond>
</Bonds>
I basically want to get the list of bond amount so i will be
10000
15000
Thanks
<Bonds>
<Bond>
<State>CA</State>
<BondAmountListing>
<BondAmount>10000</BondAmo
<BondAmount>15000</BondAmo
</BondAmountListing>
/Bond>
</Bonds>
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\\Doc uments\\EE \\WebSite5 \\XMLFile. xml");
var amounts = d.Descendants("BondAmount" );
foreach (var amount in amounts)
{
Response.Write(amount.Valu e.ToString () + "\n");
}
}
}
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\
var amounts = d.Descendants("BondAmount"
foreach (var amount in amounts)
{
Response.Write(amount.Valu
}
}
}
ASKER
actually i forgot something i want to use gridview and xmldatasource. sorry my bad.
can you show me how? thanks
can you show me how? thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
no problem. I will post it soon. thank you for your helps.
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"