Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Manipulate style/classes after all controls are being created - how?

Reply
Thread Tools

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

 
 
DC
Guest
Posts: n/a
 
      01-21-2008
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
 
Reply With Quote
 
 
 
 
DC
Guest
Posts: n/a
 
      01-31-2008
On 21 Jan., 18:51, DC <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
 
DC
Guest
Posts: n/a
 
      01-31-2008
On 31 Jan., 12:42, DC <(E-Mail Removed)> wrote:
> On 21 Jan., 18:51,DC<(E-Mail Removed)> wrote:
>
>
>
>
>
> > 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
>
> }
>
> CheersDC- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -


Thank you! Just what I was looking for.

Regards
DC
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to manipulate all user controls with custom property X set to Y? Ken Fine ASP .Net 0 01-05-2007 06:08 AM
OnItemCommand in DataList, how to manipulate controls in Selected Row bdwgarth ASP .Net 1 06-22-2005 07:03 PM
To manipulate or not to manipulate Dave C++ 1 01-22-2005 10:52 PM
possible to manipulate pure HTML controls from code-behind? mike_bluestein@ya_StopSpammingMe_hoo.com ASP .Net Web Controls 0 11-03-2003 09:59 PM
possible to manipulate pure HTML controls from code-behind? Jeff ASP .Net 3 11-02-2003 09:18 PM



Advertisments