Hello all,
This probably applies to controls other then the listbox but it's what
I'm having my problem with now. Can anyone tell me if the databinding
event is called late in the cycle or not. I ask because when I use a
declaritive SqlDataSource control with my list box I am checking the
listbox.Items.Count in the page load event and it's always zero.
I wanted to do a foreach ListItem in listbox.Items but it's empty.
Thanks
Eliyahu Goldin - 30 Oct 2007 09:17 GMT
Put the foreach loop in the PreRender event for either listbox or the page.
In PreRender event controls are already fully built.

Signature
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
> Hello all,
>
[quoted text clipped - 7 lines]
>
> Thanks
Masudur - 30 Oct 2007 12:40 GMT
On Oct 30, 6:07 am, "mohaa...@gmail.com" <mohaa...@gmail.com> wrote:
> Hello all,
>
[quoted text clipped - 7 lines]
>
> Thanks
Hi,
Try Perform your operation onRender method..
Thanks
Masudur
Dave Bush - 30 Oct 2007 13:01 GMT
Page_Load is one of the first events that fires. You want to get the
count during the DataBound event of the ListBox
-----Original Message-----
From: mohaaron@gmail.com [mailto:mohaaron@gmail.com]
Posted At: Monday, October 29, 2007 8:07 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: SqlDataSource databinding a listbox
Subject: SqlDataSource databinding a listbox
Hello all,
This probably applies to controls other then the listbox but it's what
I'm having my problem with now. Can anyone tell me if the databinding
event is called late in the cycle or not. I ask because when I use a
declaritive SqlDataSource control with my list box I am checking the
listbox.Items.Count in the page load event and it's always zero.
I wanted to do a foreach ListItem in listbox.Items but it's empty.
Thanks
mohaaron@gmail.com - 30 Oct 2007 17:27 GMT
OK, I manage to find another way to make this work. If I call the
listbox.Databind() method it binding happens earlier so I now do this
before I want to do the foreach loop.
Thanks for all your answers. Knowing that I can also do this on the
PreRender event is good also.
> Page_Load is one of the first events that fires. You want to get the
> count during the DataBound event of the ListBox
[quoted text clipped - 20 lines]
>
> - Show quoted text -