<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx</link><description>Here is a neat "trick" you can do with the Data controls. If you have an array of data you want to format, you can just directly assign it to the Datasource property kind of like this: &amp;lt;% @ Page Language ="VB" %&amp;gt; &amp;lt;! DOCTYPE html PUBLIC "-//W3C</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx#1455701</link><pubDate>Tue, 23 Jan 2007 13:01:07 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1455701</guid><dc:creator>ppayal</dc:creator><author>ppayal</author><description>&lt;p&gt;Hi Danny,&lt;/p&gt;
&lt;p&gt;I found this article helpful. Can you please tell me the following:&lt;/p&gt;
&lt;p&gt;I have used a string array e.g array of alphabets from a to z. I assign it to a datalist control. Now I want that when he clicks on 'd' there should be a postback and all names starting with letter 'd' are displayed in dropdownlist.&lt;/p&gt;
&lt;p&gt;Can you please help me?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;ap.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1455701" width="1" height="1"&gt;</description></item><item><title>re: Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx#434434</link><pubDate>Tue, 03 Jan 2006 20:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:434434</guid><dc:creator>Danny Chen</dc:creator><author>Danny Chen</author><description>Try using this code translator, it works quite well:  &amp;lt;a href=&amp;quot;&lt;a target="_new" href="http://www.carlosag.net/Tools/CodeTranslator/Default.aspx&amp;quot;&amp;gt;http://www.carlosag.net/Tools/CodeTranslator/Default.aspx&amp;lt;/a&amp;gt;"&gt;http://www.carlosag.net/Tools/CodeTranslator/Default.aspx&amp;quot;&amp;gt;http://www.carlosag.net/Tools/CodeTranslator/Default.aspx&amp;lt;/a&amp;gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;--&lt;br&gt;Danny&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=434434" width="1" height="1"&gt;</description></item><item><title>re: Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx#434425</link><pubDate>Tue, 03 Jan 2006 19:43:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:434425</guid><dc:creator>Could you please post the example in c# as well</dc:creator><author>Could you please post the example in c# as well</author><description>Could you please post the example in c# as well&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=434425" width="1" height="1"&gt;</description></item><item><title>re: Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx#433851</link><pubDate>Thu, 22 Dec 2005 19:31:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:433851</guid><dc:creator>Danny Chen</dc:creator><author>Danny Chen</author><description>Josh,&lt;br&gt;  The HierarchicalDataBoundControl requires that the DataSource be either an IHierarchicalEnumerable or an IHierarchicalDataSource.  The MenuItemCollection is an ICollection so you could not bind an arbitrary HierarchicalDataBoundControl (Menu, TreeView, or other) to a MenuItemCollection.  &lt;br&gt;&lt;br&gt;However, if you desired to use a MenuItemCollection as the base storage mechanism for your data, you could create your own classes implementing these two interfaces as I've shown above and fill out the required functions with respect to a MenuItemCollection.  You should be able to use the enumerator for the ICollection in the IHierarchicalEnumerable.  You can pass in the enumerated item to the IHierarchyData class (perhaps created dynamically inside GetHierarchyData).  The MenuItem should contain all the information you need to fill in the necessary interfaces.&lt;br&gt;--&lt;br&gt;Danny&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=433851" width="1" height="1"&gt;</description></item><item><title>re: Setting the DataSource property of a Menu or TreeView to an array</title><link>http://weblogs.asp.net/dannychen/archive/2005/12/05/432382.aspx#433847</link><pubDate>Thu, 22 Dec 2005 19:13:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:433847</guid><dc:creator>Josh Rogers</dc:creator><author>Josh Rogers</author><description>This is great, but can you expand upon this more....for instance if instead of an array you were using a menuitemcollection&lt;br&gt;&lt;br&gt;It seems with this it is much more complicated as you have to build the hierarchicaldatasourceview and hierarchicaldatasource to be able to bind it to the menu, if you want to have full functionality...anywhere you know of that has an implementation of this, or could you give me a nudge in the right direction....&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=433847" width="1" height="1"&gt;</description></item></channel></rss>