Page_Load event fires multiple times?

Discussion in 'ASP .Net' started by Jeffrey Ah-Chong, Jul 14, 2006.

  1. 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
    Jeffrey Ah-Chong, Jul 14, 2006
    #1
    1. Advertising

  2. 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
    >
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Jul 14, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon
    Replies:
    1
    Views:
    11,374
    George Ter-Saakov
    Jan 13, 2004
  2. Jay Douglas
    Replies:
    7
    Views:
    600
  3. Arjen Hoekstra

    page_load fires two times

    Arjen Hoekstra, Jul 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    597
    Arjen Hoekstra
    Jul 23, 2004
  4. Alex D.
    Replies:
    6
    Views:
    3,724
    Alex D.
    Nov 22, 2005
  5. Replies:
    3
    Views:
    994
Loading...

Share This Page