Have you ever tried to decoratively set an attribute of a server-side control to some public property/value defined in code-behind code (or in a Business Layer)? Here's a simple example:
And in a code-behind file:
This example doesn't work, ASP.NET engine does not process hitest and displays a text box with <%=hitest %> inside.
I know, I'm doing something stupid and show everybody that I understand nothing about ASP.NET, but here's a reasoning behind my attempts:
In our application we use AjaxControlToolkit, and in particular - MaskedEditExtender. There is a complicated WebForm with a ListView and numerous text boxes for entering phones, there were millions of MaskEditExtenders with identical masks set to @"(9{3}) 9{3}-9{4}". (The same story for emails.) I don't like clattering a code with "magic" strings and numbers, so I decided to declare constants and toplace them into our common class sitting in App_Code:
Then, I thought, I would set
<cc1:MaskedEditExtender Mask="<%#CoTs.Partners.Common.Util.PhoneMask %>"
So, again: is there a way to decoratively set an attribute of a server-side control to some public property/value (defined in code-behind code or in a Business Layer)?
Suprizingly, I couldn't find any information on a Web....