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

Discussion in 'ASP .Net' started by DC, Jan 21, 2008.

  1. DC

    DC Guest

    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
     
    DC, Jan 21, 2008
    #1
    1. Advertising

  2. DC

    DC Guest

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

    On 21 Jan., 18:51, DC <> 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
     
    DC, Jan 31, 2008
    #2
    1. Advertising

  3. DC

    DC Guest

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

    On 31 Jan., 12:42, DC <> wrote:
    > On 21 Jan., 18:51,DC<> 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
     
    DC, Jan 31, 2008
    #3
    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. Rob Nicholson
    Replies:
    3
    Views:
    815
    Rob Nicholson
    May 28, 2005
  2. Dave
    Replies:
    1
    Views:
    344
    Mike Wahler
    Jan 22, 2005
  3. Ken Fine
    Replies:
    0
    Views:
    299
    Ken Fine
    Jan 5, 2007
  4. Isaac Rodriguez

    Are all classes new-style classes in 2.4+?

    Isaac Rodriguez, Dec 31, 2006, in forum: Python
    Replies:
    4
    Views:
    398
    Steven D'Aprano
    Dec 31, 2006
  5. Fabian

    Manipulate all tags

    Fabian, Nov 7, 2003, in forum: Javascript
    Replies:
    3
    Views:
    109
    Lasse Reichstein Nielsen
    Nov 7, 2003
Loading...

Share This Page