views:

55

answers:

1

Binding expressions (e.g. <%# %>) are only permitted in ASP.NET skins in a very limited manner.

It appears that only Eval(“”) statements with literal arguments are accepted.

No formatting functions or composite expressions are allowed.

Two part question:

  1. How does one support Text='<%# Eval(MyEnum.FirstName) %>' inside a skin

  2. How does one support Text='<%# Eval(MyEnum.FirstName) + Eval(MyEnum.LastName) %>' inside a skin

A: 

Will this work?

<%= MyEnum.FirstName %>

edit: hang on, that'll only work if you're outputting raw html. Is that what you're trying to achieve?

edit: Why not add a property to your MyEnum class that does your concatenation for you? Eg something like:

public string FullName { get { return FirstName + ' ' + LastName; } }

Then your binding expression could be:

<%# Eval(MyEnum.FullName) %>
Chris
No, these are binding expressions applied to control properties.
Sam
I'm sorry if this is not clear but there are two separate, distinct problems. Problem #1: Eval() in skin files only accepts literals and not strings or enums. Problem #2: Eval() in skin files does not accept composite expressions (concatenations, formatting functions, etc). Yes, it's possible to push all of this up to the source object as a last resort but I would like to understand what the limitation stems from and if there is a better work-around.
Sam
No worries mate, i don't think i can help you there.
Chris