How do I programmatically set property of control in aspx file ?

Posted by Thomas Wanner on Stack Overflow See other posts from Stack Overflow or by Thomas Wanner
Published on 2010-05-27T07:15:09Z Indexed on 2010/05/27 7:41 UTC
Read the original article Hit count: 254

Filed under:
|
|
|
|

This may be a very dumb question but I can't seem to get it working. I use at many places the following syntax for dynamically binding a property of a control in aspx file to the resource entry, e.g.

<SomeFunnyControl Text="<%$ Resources : ResClass, ResEntry %>" />

I want to do a similar thing with a class containing some constants, something like

<SomeFunnyControl Text="<%= MyConstantsClass.MyStringConstant %>" />

But this doesn't seem to work, it simply sets the text to the exact expression without evaluating it. I am using ASP.NET 3.5 btw.

I have tried the databinding approach but I get an HttpParseException saying

Databinding expressions are only supported on objects that have a DataBinding event.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET