c# - Generate TreeView from XML file -


i want create treeview data source xml file. need customize visible name of element.

what have:

<?xml version="1.0" encoding="utf-8"?>  <list>   <sitemapnode title="title1" url="http://example.com/pages/general.aspx" description="description1">     <sitemapnode title="title2" url="http://example.com/pages/base.aspx" description="description2"/>  </sitemapnode>  <sitemapnode title="title3" url="http://example.com/lists/news.aspx" description="description3"> </sitemapnode>    </list> 

and can generate:

list   sitemapnode      sitemapnode   sitemapnode 

and want get:

list   title1     title2   title3 

upd: generate treeview in .aspx:

<asp:xmldatasource id="xmldatasource1" runat="server" datafile="footersitemap.xml"></asp:xmldatasource>  <asp:treeview id="treeview1" runat="server" datasourceid="xmldatasource1" showlines="true" showcheckboxes="all">      <databindings>         <asp:treenodebinding datamember="{sitemapnode_id}" textfield="{sitemapnode_id}" valuefield="{sitemapnode_id}"  />         <asp:treenodebinding datamember="{sitemapnode_id_0}" textfield="{sitemapnode_id_0}" valuefield="{sitemapnode_id_0}" />         <asp:treenodebinding datamember="{title}" textfield="{title}" valuefield="{title}" />         <asp:treenodebinding datamember="{url}" textfield="{url}" valuefield="{url}" />         <asp:treenodebinding datamember="{description}" textfield="{description}" valuefield="{description}" />     </databindings>  </asp:treeview> 

how can generate .aspx.cs ?

use attributes value of sitemapnode like,

var attr = node.attributes["title"]; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -