Any way to set attributes for server controls by referencing properties/methods/variables?

P

Paul

Hi all,

I'm trying to find a declarative way to set server control attributes
using the attribute="<%= SomeValue %>" syntax.

This works fine for basic HTML controls, but server controls will
literally display the contained text, but won't execute the containing
code.

It works fine if I use the attribute="<%# SomeValue %>" syntax and
calling DataBind() in the code behind, but this feels really ugly.

Other than just setting the attribute in the code behind, is there a
better way to do this?

Any help would be appreciated.

Thanks,

Paul
 
G

Guest

The databinding is how you do this. It isnt ugly, its just the way its done
<%= is shorthand for Response.Write which wont give server controls
information but is suposed to write things to the client on render.
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top