ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> DevelopMentor-dotNET
DevelopMentor-dotNET
Re: [DOTNET] Programmatically accessing Webform HTML
by Thomas Tomiczek other posts by this author
Nov 23 2001 5:26PM messages near this date
Re: [DOTNET] (SOLUTION) Question: How to show a menu on a NotifyIcon when the user clicks (left, once)? | Re: [DOTNET] Programmatically accessing Webform HTML
Jim, it IS bad style to mess around with the parent's properties, EXCEPT
with HTML, where you have explicit locations for example to set a JS
include file, or to have something executed at page load. Assume your
server side control wants some javascript executed upon page load....

Messing around with the "parent" properties is pretty often the Body tag
or things in the header - and here the HTML "approach" of never having
been designed for this comes back and hits you full speed.

Thomas Tomiczek
THONA Consulting Ltd.
Microsoft MVP (.NET / C#)

-----Original Message-----
From: Jim Arnold [mailto:Jim.Arnold@[...].COM] 
Sent: Freitag, 23. November 2001 18:19
To: DOTNET@[...].COM
Subject: Re: [DOTNET] Programmatically accessing Webform HTML

I see what you mean.  Well, this is a shot in the dark, but can you hook
into a Control's child controls at the load or pre-render stage?
Literal
HTML is added to the page as LiteralControls, so maybe you could hunt
for
<body>  in the control collection.  Doubt it though.  Anyway, isn't it
bad
manners to mess around with a parent's properties?  If I've set up a
style
for my page control, I don't really want its children screwing with it!


Jim

-----Original Message-----
From: Thomas Tomiczek [mailto:t.tomiczek@[...].COM]
Sent: 23 November 2001 16:53
To: DOTNET@[...].COM
Subject: Re: [DOTNET] Programmatically accessing Webform HTML


Ok, that's a simple version for the case that the author explicitly
limited it to - but you need to make the body attribute a generic
control. What if a user control wants to add something to the body tag
(which, to my shame, was more what I had in mind - SORRY for the wrong
post here)?

Thomas Tomiczek
THONA Consulting Ltd.
Microsoft MVP (.NET / C#)

-----Original Message-----
From: Jim Arnold [mailto:Jim.Arnold@[...].COM]
Sent: Freitag, 23. November 2001 17:41
To: DOTNET@[...].COM
Subject: Re: [DOTNET] Programmatically accessing Webform HTML

Body.Attributes["bgcolor"] = "green";
...
<body id=Body runat=server> 


(It's an HtmlGenericControl)

Jim

-----Original Message-----
From: Thomas Tomiczek [mailto:t.tomiczek@[...].COM]
Sent: 23 November 2001 16:38
To: DOTNET@[...].COM
Subject: Re: [DOTNET] Programmatically accessing Webform HTML


The next one with this wish :-)

If you find an answer elsewhere, please post it to the list, too -
that's a sometimes necessary thing (especially with the Body tag),
though I think you will find out it is not possible. The HTML does not
exist in a form that is more organized tan a data stream. The stream is
constructed dynamically, and I do not thing you can just add a tag to
the body tag.

BUT - this is only my opinion, I never tried it out severely, so I might
err here.

Thomas Tomiczek
THONA Consulting Ltd.
Microsoft MVP (.NET / C#)

-----Original Message-----
From: Greg Gates [mailto:ggates@[...].CA]
Sent: Freitag, 23. November 2001 17:31
To: DOTNET@[...].COM
Subject: [DOTNET] Programmatically accessing Webform HTML

Hello

I would like to programmatically access the elements that exist in the
HTML
view of a Webform from the code behind (aspx.cs) file.
Specifically, I wish to to add an attribute to the BODY element at
runtime.
It's not clear to me how to get at the BODY element from the code behind
page, if it is indeed possible.

thanks, Greg

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Thread:
Thomas Tomiczek
Ollie Cornes

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved