i want to select data from xml file where id=1;
then outcome output bind with Detalview..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Santhosh NPosted Jan 4, 2010, 1:04 AM
xml.LoadXml(str); // suppose that str string contains "
//alternatively you can use Load to load xml file by giving path of the file..
//Use xpath to select nodes based on the attribute value as
XmlNodeList xnList = xml.SelectNodes("/Root/Inbox[@id='1']");
this is how you generate filtered nodes...
If you wanted to show selected nodes in gridview then you can easily do that directly by using xmldatasource property and setting xpath expression...
check here for exanmple and explaination on how to do this..
http://msdn.microsoft.com/en-us/library/aa479341.aspx
Lalit MPosted Jan 4, 2010, 12:41 AM
do first create a new XML-File and populate it with some data,show here example:
Drag a GridView control on your web form. Next you need some code to bind the data from the XML-file to your GridView.
Page_Loadevent we create a new DataSet and use the methodReadXmlto get the data from the XML-file. Then we bind the DataSet to the GridView