Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / January 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DC - 21 Jan 2008 17:51 GMT
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 - 31 Jan 2008 11:42 GMT
> Hi,
>
[quoted text clipped - 17 lines]
> 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 - 31 Jan 2008 13:24 GMT
> > Hi,
>
[quoted text clipped - 36 lines]
>
> - Zitierten Text anzeigen -

Thank you! Just what I was looking for.

Regards
DC

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.