Page_Load event fires multiple times?

J

Jeffrey Ah-Chong

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
 
G

Guest

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!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,477
Members
44,898
Latest member
BlairH7607

Latest Threads

Top