473,394 Members | 1,840 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,394 software developers and data experts.

Page_Load event fires multiple times?

Hi Guys

I have a repeater control that I have bound a dataview to. Added to that I
have a custom ItemTemplate (class) that I apply to the repeater. It works
right and displays my data according to my format. Everything is done
programmatically, that is creation of control, initialisation and adding
it to the RepeaterItem.

The problem is that once I add a control to the RepeaterItem, the page get
reloaded! That is processing restarts from the start! So for a dataset
that contains 15 records, the page gets processed around 140 times! I
believe this happens coz control state has changed from the previous call.
Plus I got a value gathered from a request.form statement that
understandably is obtained only on the first call.Using a static variable
caters for this problem.
Through my extensive search on the net i haven't seen any solution up til
now.

Can anyone explain to me what to do? I don't want any overhead on page
calls especially because i may have thousands of records to process!

Thanks
Jeff
Jul 14 '06 #1
1 1793
If you are doing anything other than a simple bind, using examples on the
web, you may want to use the grid binding event to dynamically add the
control. Another potential option is turning off ViewState, but this is only
applicable if you do not have to persist values across PostBacks (i.e., user
changes and submits and there are not "in grid" controls that fire a
postback).

Hope this helps.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Jeffrey Ah-Chong" wrote:
Hi Guys

I have a repeater control that I have bound a dataview to. Added to that I
have a custom ItemTemplate (class) that I apply to the repeater. It works
right and displays my data according to my format. Everything is done
programmatically, that is creation of control, initialisation and adding
it to the RepeaterItem.

The problem is that once I add a control to the RepeaterItem, the page get
reloaded! That is processing restarts from the start! So for a dataset
that contains 15 records, the page gets processed around 140 times! I
believe this happens coz control state has changed from the previous call.
Plus I got a value gathered from a request.form statement that
understandably is obtained only on the first call.Using a static variable
caters for this problem.
Through my extensive search on the net i haven't seen any solution up til
now.

Can anyone explain to me what to do? I don't want any overhead on page
calls especially because i may have thousands of records to process!

Thanks
Jeff
Jul 14 '06 #2

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

Similar topics

2
by: TF | last post by:
hi, i am using a ListBox control on a windows form using VB.Net. when i set the DataSource property of the control to an ArrayList it fires following events in this order: SelectedIndexChanged...
7
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
2
by: magister | last post by:
Hello I have a default.aspx page with which has an iframe. In the code-behind of the default.aspx page it loads the 'src' attribute of the iframe. The iframe loads another aspx page, but...
14
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
4
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
0
by: pat.allan | last post by:
Hi All This seems to be a common problem here, but I've not found a solution yet to fix it for me. When I request a page through a browser, the page_load fires once. When I request the page's...
12
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference,...
2
by: AMDRIT | last post by:
Hello Everyone, I am having an issue where an event appears to be fired repeatedly where I only expect it to be fired once. See below for objects and behaviors. I have a control that contains...
2
by: Simon Harvey | last post by:
Hi Guys, Can anyone tell me why the DataGridView.SelectionChanged event fires twice when I databind to it. If I do the following, the first row is selected automatically, but the changed...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.