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. Advertisements

  2. Jeffrey Ah-Chong

    Guest 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!
    ***************************
     
    Guest, Jul 14, 2006
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.