Putting a server side control inside an html element attribute

  • Thread starter Thread starter John Lau
  • Start date Start date
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
 
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
 
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.
 
Back
Top