﻿<?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 - WebEssentials - WebListBox cant detect Selected item is this a bug?</title><link>http://www.intersoftsolutions.com/Community/WebEssentials/WebListBox-cant-detect-Selected-item-is-this-a-bug/</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>WebListBox cant detect Selected item is this a bug?</title><link>http://www.intersoftsolutions.com/Community/WebEssentials/WebListBox-cant-detect-Selected-item-is-this-a-bug/</link><pubDate>Fri, 10 Jun 2011 02:25:54 GMT</pubDate><dc:creator>Riendy</dc:creator><category>bug</category><category>postback</category><category>weblistbox</category><category>selected</category><category>item</category><description>&lt;p&gt;Hi Neil,&lt;/p&gt;&lt;p&gt;Would you please let me know which one didn't work ? Did you get an error or something ?&lt;/p&gt;
&lt;p&gt;Attached is my simple runable sample (WebListBox - SelectedItem). Is it possible for you to take a look at  my attachment? Please let me know if it is still not answer you question.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thank you.&lt;br /&gt;Riendy&lt;/p&gt;</description></item><item><title>WebListBox cant detect Selected item is this a bug?</title><link>http://www.intersoftsolutions.com/Community/WebEssentials/WebListBox-cant-detect-Selected-item-is-this-a-bug/</link><pubDate>Thu, 09 Jun 2011 09:49:36 GMT</pubDate><dc:creator>neil.turner@ntd.co.uk</dc:creator><category>bug</category><category>postback</category><category>weblistbox</category><category>selected</category><category>item</category><description>&lt;p&gt;No that didn't work either&lt;/p&gt;&lt;p&gt;The selectedIndex just isn't being persisted on postback&lt;/p&gt;</description></item><item><title>WebListBox cant detect Selected item is this a bug?</title><link>http://www.intersoftsolutions.com/Community/WebEssentials/WebListBox-cant-detect-Selected-item-is-this-a-bug/</link><pubDate>Tue, 07 Jun 2011 00:19:52 GMT</pubDate><dc:creator>Riendy</dc:creator><category>bug</category><category>postback</category><category>weblistbox</category><category>selected</category><category>item</category><description>&lt;p&gt;Hi Neill,&lt;/p&gt;&lt;p&gt;To add selected WebListBoxItem to another WebListBoxItem, I suggest you to use SelectedIndex property in WebListBox. SelectedIndex is also usefull because you don't have to do looping to find a selected items. You can change your code behind into codes bellow :&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt; protected void btnAddItem_Click(object sender, EventArgs e)
 { 
    int i = WebListBox1.SelectedIndex;
    WebListBoxItem wli = new WebListBoxItem();
    wli.Name = WebListBox1.Items[i].Name;
    wli.Text = WebListBox1.Items.GetNamedItem(wli.Name).Text;
    WebListBox2.Items.Add(wli);
 }&lt;/pre&gt;
&lt;p&gt;Please let me know whether it is work as your expectation or not ?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;br /&gt;Riendy&lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>WebListBox cant detect Selected item is this a bug?</title><link>http://www.intersoftsolutions.com/Community/WebEssentials/WebListBox-cant-detect-Selected-item-is-this-a-bug/</link><pubDate>Mon, 06 Jun 2011 06:57:41 GMT</pubDate><dc:creator>neil.turner@ntd.co.uk</dc:creator><category>bug</category><category>postback</category><category>weblistbox</category><category>selected</category><category>item</category><description>&lt;p style=""&gt;I'm trying to get the selected item of a WebListBox on post back so i can add one item in a weblistbox to another WebListBox but the selected item isn't being detected selected when the button is clicked&lt;/p&gt;
&lt;p style=""&gt;Code below&lt;/p&gt;
&lt;p style="" /&gt;
&lt;p style=""&gt;               &amp;lt;table cellspacing="0" cellpadding="0"&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;tr valign="top"&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;td&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                        &amp;lt;ISWebEssentials:WebListBox ID="WebListBox1" runat="server" Height="160px" &lt;/p&gt;
&lt;p style=""&gt;                            Width="250px" &amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                            &amp;lt;Items&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                                &amp;lt;ISWebEssentials:WebListBoxItem Name="WebListBoxItem0" Text="1" /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                                &amp;lt;ISWebEssentials:WebListBoxItem Name="WebListBoxItem1" Text="2" /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                                &amp;lt;ISWebEssentials:WebListBoxItem Name="WebListBoxItem2" Text="3" /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                                &amp;lt;ISWebEssentials:WebListBoxItem Name="WebListBoxItem3" Text="4" ToolTip="4" /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                            &amp;lt;/Items&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                            &amp;lt;/ItemStyle&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=""&gt;                        &amp;lt;/ISWebEssentials:WebListBox&amp;gt;&amp;lt;/td&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;td width="60" align="center" valign="middle"&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                        &amp;lt;asp:Button ID="Button1" runat="server" Text="Add" ToolTip="Add item" onclick="btnAddItem_Click" /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;/td&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;td&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                        &amp;lt;ISWebEssentials:WebListBox ID="WebListBox2" runat="server" Height="160px" Width="250px"&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                            &amp;lt;Items&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                                &amp;lt;ISWebEssentials:WebListBoxItem Name="WebListBoxItem0" Text="a" /&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                            &amp;lt;/Items&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                        &amp;lt;/ISWebEssentials:WebListBox&amp;gt;&amp;lt;/td&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                    &amp;lt;/tr&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;                &amp;lt;/table&amp;gt;&lt;/p&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=""&gt;Code behind&lt;/p&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style="" /&gt;
&lt;p style=""&gt;        protected void btnAddItem_Click(object sender, EventArgs e)&lt;/p&gt;
&lt;p style=""&gt;        {&lt;/p&gt;
&lt;p style=""&gt;            foreach (WebListBoxItem wli in WebListBox1.Items)&lt;/p&gt;
&lt;p style=""&gt;            {&lt;/p&gt;
&lt;p style=""&gt;                if (wli.Selected)&lt;/p&gt;
&lt;p style=""&gt;                {&lt;/p&gt;
&lt;p style=""&gt;                    WebListBox2.Items.Add(wli);&lt;/p&gt;
&lt;p style=""&gt;                }&lt;/p&gt;
&lt;p style=""&gt;            }&lt;/p&gt;
&lt;p style=""&gt;        }&lt;/p&gt;
&lt;p /&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=""&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p /&gt;</description></item></channel></rss>