Putting a server side control inside an html element attribute

J

John Lau

Hello,

In Asp, you can render a server side variable inside the quotes in an html
element attribute. For example:

<link rel="stylesheet" href="<%=SomeVariableName%>" type="text/css">

I'm trying to do something similar in Asp.Net:

<link rel="stylesheet" href="<SomePlaceholderControl runat=server>"
type="text/css">

However, Asp.Net sees the characters inside the quotes as literal text. Is
there a way to put a server side control inside the quotes?

Thanks,
John
 
J

John Lau

We're migrating our Asp websites to Asp.net. Most of our designers and
developers have never seen Asp.net, so phase one is just a port. Phase two
will be a rewrite.

John
 
P

Peter Rilling

ASP.NET still supports inline code.

But as for your original questions, probably not. I have never seen this
done, simply because server-side controls are tags and attributes are only
constant values.
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top