Working with LINQ to XML



Binding GrdView from xml using LINQ

protected void Page_Load(object sender, EventArgs e) 
{
XDocument xmlDoc = XDocument.Load(@"c:syntaxhelp.xml");
var q = from c in xmlDoc.Descendants("Topic")
where c.Attribute("technical").Value == "true"
select new 
{
name = c.Element("name").Value,
url = c.Element("url").Value
};
gvSyntaxHelp.DataSource = q;
gvSyntaxHelp.DataBind();

} 

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.