I have a question about handing data within a template definition for a
DataList. In my aspx I'm trying to output different values surrounding a
datafield depending on the value of another datafield. Here's a glimpse of
code of what I'm trying to accomplish:
<asp:DataList ...>
<ItemTemplate>
<# DataBinder.Eval(Container.DataItem, "bBooleanField") %><br/>
<% if ((bool) DataBinder.Eval(Container.DataItem, "bBooleanField"))
{ %>true<% } else { %>false<% } %>
</ItemTemplate>
</asp:DataList>
If the field "bBooleanField" for that row is true, I'd like "true" to be
printed on that line, otherwise "false" --- if I can get past this point
I'll be replacing those "true|false" strings with other DataBinder
expressions - but I need to get this far first. The error I'm getting when
doing this is "The type or namespace name 'Container' could not be found
(are you missing a using directive or an assembly reference?)". I've tried
a few variations of syntax & adjusting the <% and <%# tags but with no luck.
Anyone have any ideas how this can be done? As you've probably guessed from
the if statement - I'm using c# & doing most of the coding in code-behind
pages.