LIstbox in Web aplication

  • Thread starter Thread starter Midger
  • Start date Start date
M

Midger

I've found a trouble with using Listbox cortrol in Web application.
I've used it previously and all works good.
I can get which elements are selection.

for (int nrp = 1; nrp < lbWorker.Items.Count; nrp++)
{
if (lbWorker.Items[nrp].Selected)
{

if(txtEmailAdres.Text.IndexOf(lbWorker.Items[nrp].Value)<0)
txtEmailAdres.Text += lbWorker.Items[nrp].Value
+";";
}
}
In this case the property Selected is set on false for all of the
elements.

Is there any changes in that component in last time.
I use VS 2005.
 
I've found a trouble with using Listbox cortrol in Web application.
I've used it previously and all works good.
I can get which  elements  are selection.

 for (int nrp = 1; nrp < lbWorker.Items.Count; nrp++)
                {
                    if (lbWorker.Items[nrp].Selected)
                    {

if(txtEmailAdres.Text.IndexOf(lbWorker.Items[nrp].Value)<0)
                        txtEmailAdres.Text += lbWorker.Items[nrp].Value
+";";
                    }
                }
In this case the property Selected is set on false for all of the
elements.

Is there any changes in that component in last time.
I use VS 2005.

Are you sure there are at least one selected?

Hint, if you can select only one item you could also try SelectedItem/
SelectedIndex properties of the ListBox control
 
I made many tests where I couldn't found the reason of this error. Of
course I wrote the event SelectedIndexChanged for this component. The
event function was fired but,during debugging mode, in the watch
window all the items have false value in Selection property.
I've also tried to create the new one but the result was the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top