I've been struggling to get a repeater control set up to check a record
field, and, depending on what it is, render a different HTML template.
I've tried using a simple server-side span:
<span runat="server" Visible='<%# DataBinder.Eval(Container.DataItem,
"Application").ToString() = "Notice" %>'>
<custom html>
</span>
....and calling a function:
<%# TestSub(DataBinder.Eval(Container.DataItem, "Application"))%>
Function TestSub(ByVal YourItem as String)
If (YourItem="Notice") Then
Return "it works!"
Else
Return YourItem
End If
End Function
I've (FINALLY!) narrowed down the problem to the actual comparison. The same
thing happens with both methods...I can NOT get the data to evaluate to
TRUE. I've tried a number of things like:
<%# DataBinder.Eval(Container.DataItem, "Application") %>
= Notice
<%# DataBinder.Eval(Container.DataItem, "Application") = "Notice" %>
= False
<%# DataBinder.Eval(Container.DataItem, trim("Application")) =
trim("Application") %>
= False (this one REALLY has me stumped)
<%# Convert.ToBoolean(DataBinder.Eval(Container.DataIt em,
trim("Application")).ToString() = "Notice") %>
= False
So, it appears that I'm not comparing two identical things. And I'm not sure
what else to look at here. Is this an issue with SQL server, perhaps? Do I
need to caste these values as something completely different?