Understanding OnPreRender and how to use it

Discussion in 'ASP .Net' started by Tarun Mistry, Feb 13, 2006.

  1. Tarun Mistry

    Tarun Mistry Guest

    Hi everyone.

    I have a usercontol that changes one of the ViewState variables, it does
    this when a button within it is pressed.

    I would like to alter the appearance of the page based on this view state
    variable, however i am told that the page has already been rendered at this
    point, what do i need todo to make my page "rerender" with the new viewstate
    information?

    Im really unsure what to express in the main page object to accomplish this,
    will my user control have to raise an event or something (again stuck, i
    need to figure this out! :))

    Alternatively, does anyone have a work around for this?

    Thanks for all your help everyone.
    Taz
     
    Tarun Mistry, Feb 13, 2006
    #1
    1. Advertising

  2. Tarun Mistry

    Newbie Guest

    If you want to change the appearance of the page, you need to do so at the
    latest in the pages pre-render event. Organise things this way and you will
    be ok.



    "Tarun Mistry" <> wrote in message
    news:%...
    > Hi everyone.
    >
    > I have a usercontol that changes one of the ViewState variables, it does
    > this when a button within it is pressed.
    >
    > I would like to alter the appearance of the page based on this view state
    > variable, however i am told that the page has already been rendered at
    > this point, what do i need todo to make my page "rerender" with the new
    > viewstate information?
    >
    > Im really unsure what to express in the main page object to accomplish
    > this, will my user control have to raise an event or something (again
    > stuck, i need to figure this out! :))
    >
    > Alternatively, does anyone have a work around for this?
    >
    > Thanks for all your help everyone.
    > Taz
    >
     
    Newbie, Feb 13, 2006
    #2
    1. Advertising

  3. Hi Taz,

    I would be careful about believing anything "i am told." Even well-meaning
    people can be wrong. When I am told something, even by someone I know, I put
    the information into my "data for verification" memory area, and make a note
    to research it. Here's a good reference for you. It tells you everything
    that happens during the Page's execution (and any other ASP.Net Control's
    execution), and when:

    http://msdn.microsoft.com/library/d...guide/html/cpconControlExecutionLifecycle.asp

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    We got a sick zebra a hat,
    you ultimate tuna.


    "Tarun Mistry" <> wrote in message
    news:%...
    > Hi everyone.
    >
    > I have a usercontol that changes one of the ViewState variables, it does
    > this when a button within it is pressed.
    >
    > I would like to alter the appearance of the page based on this view state
    > variable, however i am told that the page has already been rendered at
    > this point, what do i need todo to make my page "rerender" with the new
    > viewstate information?
    >
    > Im really unsure what to express in the main page object to accomplish
    > this, will my user control have to raise an event or something (again
    > stuck, i need to figure this out! :))
    >
    > Alternatively, does anyone have a work around for this?
    >
    > Thanks for all your help everyone.
    > Taz
    >
     
    Kevin Spencer, Feb 13, 2006
    #3
  4. Tarun Mistry

    Tarun Mistry Guest

    Hi all, many thanks for your replies.

    I have indeed got it working following your rendering advice. it seems
    trying to save and then load data into the viewstate in one go doesnt work!

    Thanks again!

    With kind regards,
    Taz
     
    Tarun Mistry, Feb 13, 2006
    #4
    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. Kenton Smeltzer
    Replies:
    3
    Views:
    3,605
    Kenton Smeltzer
    Oct 23, 2003
  2. Flare
    Replies:
    5
    Views:
    550
    Flare
    Nov 21, 2003
  3. Umut Tezduyar
    Replies:
    1
    Views:
    401
    Steven Cheng[MSFT]
    Oct 6, 2004
  4. Flare
    Replies:
    5
    Views:
    135
    Flare
    Nov 21, 2003
  5. Flare
    Replies:
    5
    Views:
    137
    Flare
    Nov 21, 2003
Loading...

Share This Page