Home All Groups Group Topic Archive Search About

Problem with a ListBox in code behind

Author
8 Apr 2005 6:14 PM
Mart?n Llanos via .NET 247
I've this problem, in my aspx i put a ListBox, when i add lines to this ListBox and and click de button "Guardar", a java script function is called. In that java script I have this code:

                    var lbPozosToAdd    =    document.all.lbPozosToAdd;

            for(var i = 0; i < ListBox.length; i++){
            ListBox.options[i].selected = true;
            }

This work OK, but in the code behind when I  try to validate the ListBox Ex: if(ListBox.Items.Count != 0), the count is always 0, why?

Thanks for your help, sorry my English, I'm from Argentina

--------------------------------
From: Mart?n Llanos

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>rvHEyoZSwEGwx6WbcNMWxQ==</Id>

Author
8 Apr 2005 6:22 PM
Marcie Jones
How are the items added to the ListBox?

Marcie


On Fri, 08 Apr 2005 11:14:12 -0700, Mart?n Llanos via .NET 247
<anonym***@dotnet247.com> wrote:

Show quoteHide quote
>I've this problem, in my aspx i put a ListBox, when i add lines to this ListBox and and click de button "Guardar", a java script function is called. In that java script I have this code:
>
>                    var lbPozosToAdd    =    document.all.lbPozosToAdd;
>           
>            for(var i = 0; i < ListBox.length; i++){
>            ListBox.options[i].selected = true;
>            }
>
>This work OK, but in the code behind when I  try to validate the ListBox Ex: if(ListBox.Items.Count != 0), the count is always 0, why?
>
>Thanks for your help, sorry my English, I'm from Argentina
>
>--------------------------------
>From: Mart?n Llanos
>
>-----------------------
>Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
><Id>rvHEyoZSwEGwx6WbcNMWxQ==</Id>