Manipulate style/classes after all controls are being created - how?

D

DC

Hi,

I am writing a "print control" routine which expects the id of a
control and will then make every element but the one that is supposed
to be printed invisible (only by using "display: none" style;
Visible=false causes a lot of collateral damage in my scenario).

I thought if I put this into "OnPreRender" I will catch all controls
in the state they will have in the page render method, but if there
are e.g. databound controls that are being setup in the
control_prerender method (for good reason, actually) then the
"display: none" style information may be overwritten by that method
since the page OnPreRender executes before the control's PreRender.

Is there a good time to manipulate the control tree knowing that the
alterations being made are the last ones before rendering, or a
different approach to my aim?

TIA for any hints!
Regards
DC
 
D

DC

Hi,

I am writing a "print control" routine which expects the id of a
control and will then make every element but the one that is supposed
to be printed invisible (only by using "display: none" style;
Visible=false causes a lot of collateral damage in my scenario).

I thought if I put this into "OnPreRender" I will catch all controls
in the state they will have in the page render method, but if there
are e.g. databound controls that are being setup in the
control_prerender method (for good reason, actually) then the
"display: none" style information may be overwritten by that method
since the page OnPreRender executes before the control's PreRender.

Is there a good time to manipulate the control tree knowing that the
alterations being made are the last ones before rendering, or a
different approach to my aim?

TIA for any hints!
Regards
DC

You can hook to a number of events to accomplish this, one possiblity
is:

protected override void OnInit(EventArgs e)
{
Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);
}

void Page_PreRenderComplete(object sender, EventArgs e)
{
// do the style thing
}

Cheers
DC
 
D

DC

You can hook to a number of events to accomplish this, one possiblity
is:

protected override void OnInit(EventArgs e)
{
   Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);

}

void Page_PreRenderComplete(object sender, EventArgs e)
{
   // do the style thing

}

CheersDC- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

Thank you! Just what I was looking for.

Regards
DC
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top