Subhash Sharma

Subhash Sharma
Subhash Sharma

This is Subhash Sharma(Software Engineer) Blog

Welcome to this blog and find every solution.............

Search This Blog

Software Engineer(Subhash Sharma)

Software Engineer(Subhash Sharma)
Software Engineer

Saturday, January 8, 2011

Dropdown bind through xml

XmlDocument xml = new XmlDocument();
string s =Server.MapPath("XMLfILE.xml");
string list = "/catalog/book";
xml.Load(s);
XmlNodeList xn = xml.SelectNodes(list);
foreach (XmlNode eleSourceNode in xn)
{
string ID = eleSourceNode.Attributes["id"].Value;
string author1 = eleSourceNode["author"].InnerText;
DRPLIST.Items.Add(new ListItem(author1 ,ID));
}


//XMLFILE.xml

?xml version="1.0"?>
catalog>
book id="bk101">
author>Gambardella, Matthew /author>
title>XML Developer's Guide /title>
genre>Computer /genre>
price>44.95 /price>
publish_date>2000-10-01 /publish_date>
description>
An in-depth look at creating applications
with XML.
/description>
/book>

book id="bk111">
author>O'Brien, Tim /author>
title>MSXML3: A Comprehensive Guide /title>
genre>Computer /genre>
price>36.95 /price>
publish_date>2000-12-01/publish_date>
description>
The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.
/description>
/book>
book id="bk112">
author>Galos, Mike/author>
title>Visual Studio 7: A Comprehensive Guide/title>
genre>Computer /genre>
price>49.95 /price>
publish_date>2001-04-16/publish_date>
description>
Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.
/description>
/book>
/catalog>

No comments:

Post a Comment