[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Re: Listbox control and .Items.Selected

Teemu Keiski

3/2/2004 8:33:00 AM

Hi,

how is the control populated? Is it in aspx using declarative syntax? Also
where do you run this code at Page? In Page_Load or elsewhere?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"David" <anonymous@discussions.microsoft.com> wrote in message
news:4084FBB7-05F9-47F9-95D3-19D20B608618@microsoft.com...
> I have a problem with the Listbox control in C#. It works fine in VB but
in C#, the .Selected property always returns false for some reason. I have
the Listbox Selectionmode set to Multiple. Can anyone tell me why? This
is in Visual Studio.NET 2002.
>
> Code:
>
> foreach ( ListItem oItem in lstPeriods.Items )
> {
> if ( oItem.Selected == true ) // This always returns false!
> {
>