Set href for <link tag

R

Robert Strickland

I need to dynamically set the href attribute for the <link> tag at run time
for my pages. I thought I saw code using the asp:placeholder to give the
code-behind a place to update the html control with a specific href setting.

Any ideas?

Thanks
 
S

Shiva

Hi,
Give the <link> tag id="lnk" (can be anything) and runat=server attributes.
From code-behind, use the Attributes property, like normal server-side
controls, to add attribute values:

lnk.Attributes.Add ("rel", "stylesheet")
lnk.Attributes.Add ("href", "primary.css")

HTH.

I need to dynamically set the href attribute for the <link> tag at run time
for my pages. I thought I saw code using the asp:placeholder to give the
code-behind a place to update the html control with a specific href setting.

Any ideas?

Thanks
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top