in above xml file i want to retrieve only the column1 values in listbox. could someone please tell me how to do it , i m new to C#
Loading
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.
VulpesPosted Oct 9, 2014, 8:54 AM
// ...
listBox1.DataSource = names;
raju patilPosted Oct 10, 2014, 12:51 AM
raju patilPosted Oct 10, 2014, 12:50 AM
Abhishek KumarPosted Oct 9, 2014, 11:15 AM
Please try this Code below
DataSet ds = new DataSet();
ds.ReadXml(@"D:\My Development\TestWeb\TestWeb\Test.xml");
ListBox1.DataValueField = "Column1" ;
ListBox1.DataTextField = "Column1";
ListBox1.DataSource = ds;
ListBox1.DataBind();
this is your xml i havenamed as Test.xml.
Hope this will help.
Abhishek