473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

handling page load event

Hi all,

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.

Carlos.
May 22 '06 #1
2 1036
Is your page inheriting from some master page ??

May 22 '06 #2
"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.
May 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Lloyd Sheen | last post by:
In an attempt to reformat the web page I moved controls into a frame and then when that did no good I replaced then on the aspx in the same order as before. When I did the CTL-X the handlers lost...
2
by: Gopalan | last post by:
Hi I have got a Datagrid populated with a Dataset. The first time the datagrid shows the first page data. When I clicked the Next link to display the next page data it displays the same...
9
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control...
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
3
by: c676228 | last post by:
Hi all, I have an event in user control email to handling email change when user want to change the input for email address. Here it is In email.ascx.vb: Protected Sub UpdateEmail(ByVal sender As...
15
by: tshad | last post by:
I was looking for a way to handle refreshes (user pressed refresh button) and found a piece of code to check if a Web page was refreshed but I can't get it to work. The code is:...
2
by: WolfyUK | last post by:
Hello, I have a standard asp:DataGrid called CasesGrid that I wish to write my own paging controls for. The aim is to get something like the following rendered to screen: << First < Previous...
1
by: Fred Chateau | last post by:
Can exceptions only be handled in a protected block? For example, can I globally catch and handle any exception generated from an ASP.NET page without placing the entire Page_Load event handler...
1
by: Jeremy Martin | last post by:
Hi, I am currently learning c# so be gentle :) I am converting a Delphi.NET website to c# website and I am confused as to how events are handled. 2 Situations. 1. A component on a...
1
by: Efi Merdler | last post by:
Hi, I created a user control, but instead of handling exception in the user control level I prefer to handle them in the containing form. In the load event of the containing form I'm using:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.