Understanding OnPreRender and how to use it

T

Tarun Mistry

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
 
N

Newbie

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

Kevin Spencer

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

Tarun Mistry

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
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top