"Carlos" <ch******@yahoo.com> wrote in message
news:On**************@TK2MSFTNGP05.phx.gbl...
I populate a list box during the page load
event, and I do it within the if (not page.postback())
condition. However, I do notice that the
list gets duplicated. When I debug the app, I certainly
go twice thru the logic, before the page displays.
I though that I could just be able to populate the
list when the page goes through the logic one time.
I do not know why is doing it twice.
Thanks in advance for any help.
Firstly, don't populate "reference" objects like listviews, dropdowns etc in
Page_Load - do it in Page_Init instead.
Secondly, are you populating the listview item by item i.e. by using the
Items.Add or Items.Insert methods rather than binding its DataSource
property to an ADO.NET object? If so, make sure you clear the items first by
invoking the Items.Clear() method, otherwise you'll duplicate the items
every time you postback.