LIstbox in Web aplication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Midger

    LIstbox in Web aplication

    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(txtEmailAdre s.Text.IndexOf( lbWorker.Items[nrp].Value)<0)
    txtEmailAdres.T ext += 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.
  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: LIstbox in Web aplication

    On Apr 1, 7:58 am, Midger <mid...@wp.plwr ote:
    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(txtEmailAdre s.Text.IndexOf( lbWorker.Items[nrp].Value)<0)
                            txtEmailAdres.T ext += 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

    Comment

    • Midger

      #3
      Re: LIstbox in Web aplication

      I made many tests where I couldn't found the reason of this error. Of
      course I wrote the event SelectedIndexCh anged 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.

      Comment

      Working...