﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebDesktop - NavPane-FillThroughDataSource</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/NavPane-FillThroughDataSource/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>NavPane-FillThroughDataSource</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/NavPane-FillThroughDataSource/</link><pubDate>Mon, 05 Apr 2010 23:35:52 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi Ben,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Basically, if we want to use a SQL Server Connection, we can simply set the return value as a DataTable. After we get the data in DataTable format, we can get the total count of rows and get the value of its row(we can also get by its column as well). Here is the snippet to do so:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;span class="Apple-style-span" style="font-family: 'courier new', tahoma; font-size: 12px; white-space: pre; "&gt;WebNavPane navPane = (WebNavPane)WebPaneManager1.FindControl("WebNavPane1");&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;           
        DataTable dt = new DataTable();
        
        string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True";
        
        SqlConnection conn = new SqlConnection(connString);
        SqlDataAdapter daCustomers = new SqlDataAdapter();
        
        conn.Open();
        string queryCustomers = "SELECT * FROM Categories";
        SqlCommand cmd = new SqlCommand(queryCustomers, conn);     
        
        daCustomers.SelectCommand = cmd;
        daCustomers.Fill(dt);
        
        int index = dt.Rows.Count;
            
        for (int i = 0; i &amp;lt; index; i&amp;#43;&amp;#43;)
        {
            WebNavBar[] navBar = new WebNavBar[index];
           
            WebNavBarItem[] navBarItem = new WebNavBarItem[index];
            navBar[i] = new WebNavBar();
            navBarItem[i] = new WebNavBarItem();
            navBarItem[i].Name = dt.Rows[i].ItemArray[2].ToString();
            navBarItem[i].Text = dt.Rows[i].ItemArray[2].ToString();
                      
            navBarItem[i].DisplayMode = ISNet.WebUI.WebDesktop.DisplayMode.Text;
           
            navBar[i].Name = dt.Rows[i].ItemArray[1].ToString();
            navBar[i].Text = dt.Rows[i].ItemArray[1].ToString();
            navBar[i].CaptionDisplayMode = ISNet.WebUI.WebDesktop.DisplayMode.Text;
           
            navBar[i].Items.Add(navBarItem[i]);
            navPane.Bars.Add(navBar[i]);
        }&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;I hope it helps. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>NavPane-FillThroughDataSource</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/NavPane-FillThroughDataSource/</link><pubDate>Mon, 05 Apr 2010 17:42:21 GMT</pubDate><dc:creator>bdenison</dc:creator><description>&lt;p&gt;That's great, thanks. I just need to change the data source to a SQL Server connection and I'll be set. Are there any quick examples around?&lt;/p&gt;</description></item><item><title>NavPane-FillThroughDataSource</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/NavPane-FillThroughDataSource/</link><pubDate>Sun, 04 Apr 2010 23:21:32 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><description>&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Hi Ben Denison,&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; In order to do so, since we need to create an object of NavBar and NavBarItem for each data that we have got from the database list, we will need to use an arrayed of NavBar and NavBarItem object. During the looping, we can add each NavBarItem to NavBar and then, add them to our NavPane one by one.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Here is the snippet to do so:&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;&lt;span style="font-size: 9pt; "&gt;    protected void Page_Load(object sender, EventArgs e)
    {
        WebNavPane navPane = (WebNavPane)WebPaneManager1.FindControl("WebNavPane1");

        List&amp;lt;SimpleList.Customer&amp;gt; cust = SimpleList.CustomerManager.GetCustomer();
        int index = cust.Count;

        for (int i = 0; i &amp;lt; index; i&amp;#43;&amp;#43;)
        {
            WebNavBar[] navBar = new WebNavBar[index];
           
            WebNavBarItem[] navBarItem = new WebNavBarItem[index];

            navBar[i] = new WebNavBar();
            navBarItem[i] = new WebNavBarItem();
           
            navBarItem[i].Name = cust[i].CustomerName;
            navBarItem[i].Text = cust[i].CustomerName;
            
            navBarItem[i].DisplayMode = ISNet.WebUI.WebDesktop.DisplayMode.Text;
            
            navBar[i].Name = cust[i].CustomerID.ToString();
            navBar[i].Text = cust[i].CustomerID.ToString();
            
            navBar[i].CaptionDisplayMode = ISNet.WebUI.WebDesktop.DisplayMode.Text;
           
            navBar[i].Items.Add(navBarItem[i]);
            navPane.Bars.Add(navBar[i]);
        }
    }&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; I also attached you my running sample along with the database list(SimpleList.cs). Please ensure to put this .cs file into the App_Code folder in your project.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; I hope it helps. Thank you and have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;/span&gt;&lt;/p&gt;
&lt;p /&gt;</description></item><item><title>NavPane-FillThroughDataSource</title><link>http://www.intersoftsolutions.com/Community/WebDesktop/NavPane-FillThroughDataSource/</link><pubDate>Fri, 02 Apr 2010 13:29:30 GMT</pubDate><dc:creator>bdenison</dc:creator><description>&lt;p&gt;I need to fill one bar Collection with a short list of items from a database list. Any ideas?&lt;/p&gt;</description></item></channel></rss>