I feel like i am close to getting this but i am getting a compilation error. I am using a widget template in sitefinity. I am trying to use a conditional statement based on three sets of radio buttons. Basically im trying to see if the text needs to be left right or center, dark or light and if the list item is the first to be shown. I think i am close with using the <%# eval %> but may be wrong by using the &&.
here is an example of the code...
<%# Eval("TextPosition") == 0 && Eval("ColorChoice") == 0 && Eval("IsFirst") == 0 ?
any help would be much appreciated
If='<%# Eval("TestField") %>' runat="server">
print something if yes
print something else if no
I'm just on a roll with digging up old posts, but this is almost working for me. The problem is if I have an eval statement inside the <if></if> or <then></then> blocks, it doesn't seem to work (SF 7.3).
Is this expected behavior? A bug? Or perhaps (most likely) a mistake on my part? My code is below and I get no HREF or TARGET on the links. If I add a runat="server" to them, nothing changes.
If='<%# Eval("HasChildNodes") %>' runat="server">
href='<%# NavigationUtilities.ResolveUrl(Container.DataItem) %>' target='<%# NavigationUtilities.GetLinkTarget(Container.DataItem) %>'><%# Eval("Title")%></
If='<%# Eval("CustomTextFieldName").ToString() != "" %>' runat="server">
Here is the value of the custom field:
> <%# Eval("CustomTextFieldName") %> </
No value for the custom field
I'm getting a peculiar result. The code below renders the output in the "Then" clause correctly whenever the "locationURL" field has a value. But it never renders the contents inside the "span" tag in the "Else" clause. It will render the <span></span> but not the eval'ed contents inside. Any ideas?
<sf:Conditional If='<%# Eval("locationURL").ToString() != "" %>' runat="server">
<a href='<%# Eval("locationURL") %>'> <%# Eval("Street")%> <%# Eval("City")%> <%# Eval("State")%> </a>
<span> <%# Eval("Street")%> <%# Eval("City")%> <%# Eval("State")%> </span>