get head by tagname (from server control)

P

Peter Licen

my server control generates part of page from codebehind. I get other part
from different source.
how can i get <head></head> (written inline on .aspx) from the
ControlCollection(.aspx.vb)? For example - i would like to insert metatags.

it looks getting it by ID(which i don't have) is the only possibillity (i
don't want to override rendering )
any idea(getting it by TagName maybe)?

thnx
 
S

Steve C. Orr, MCSD

If you add the runat='server' attribute to the header tags then you can
access them from your code behind.
Here's more info and a good example using the Title tag:
http://www.aspalliance.com/kenc/faq5.aspx

Another option would be to turn the whole header section into a user
control. This gives you ultimate flexibility. Then you can output whatever
you want wherever you want within the header.
 
P

Peter Lièen

thnx, but the problem is that i don't write the inline tags. I get them and
i have first to analyze them and, if nessesary, correct them.
otherways, attribute id is the best choise(it has all support from
codebehind)

sorry for the direct replay
 
S

Steve C. Orr, MCSD

Well then that boosts the second idea I mentioned, which is to make the
whole section a user (or custom) control. Then you can render whatever you
want.
 

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
474,089
Messages
2,570,602
Members
47,222
Latest member
jspanther

Latest Threads

Top