asp.net - How can I bind dynamic xml file to asp tree view? -


i trying bind information web service tree view in asp.net website. using drop down list, choose stock symbol retrieves company's information web service. outputting information string.

what trying bind tree view dynamically. i'm at:

my aspx.cs file..

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using net.webservicex.www; using system.xml;   public partial class _default : system.web.ui.page {     private net.webservicex.www.stockquote stockquote;     private string stockinfo;     private xmldocument stockdoc = new xmldocument();        protected void page_load(object sender, eventargs e)     {      }      protected void dropdownlist1_selectedindexchanged(object sender, eventargs e)     {         string symbol = dropdownlist1.selecteditem.text;         stockquote = new net.webservicex.www.stockquote();         stockinfo = stockquote.getquote(symbol);         stockdoc.loadxml(stockinfo);         test.text = stockinfo;       } } 

i cannot configure data source in design view because it's dynamic, , never used hierarchical scheme. need that? there way?

use xmldatasource , set it's datafile property desired xml file. go treeview , set it's datasourceid id of xmldatasource object.

update noticed getting xml service. in case use data property of xmldatasource object set data xml.

update declare xmldatasource in aspx markup , set datasourceid of treeview (again in markup). in code behind (in appropriate event), below.

xmldatasource.data = stockinfo; // stockinfo string variable treeview.databind(); // not sure whether necessary 

hope helps.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -