[Mono-list] Problem with DataBinder.Eval(Container.DataItem, "")
David P. Donahue
ddonahue at ccs.neu.edu
Fri Jun 3 18:25:22 EDT 2005
Not sure if this is a Mono thing or a .NET thing in general, but...
Normally, when I want to bind data to a DataList in ASP .NET, I just
bind it to a DataSet and the HTML code contains things like:
<%# DataBinder.Eval(Container.DataItem, "Title") %>
This manages to display, for each record, the text contained in the
field "Title" in the DataSet.
Now, I'm trying to add some more logic to that. As far as I know, I'd
need to lose the # in the opening bracket and I can just write code as
normal. This code should be in C# if that's what I use in my project,
right? My first step before adding any other logic was to simply change
the above to:
<% Response.Write(DataBinder.Eval(Container.DataItem, "Title")); %>
However, I get an error at runtime saying that the name "Container"
can't be found in the class.
Is this by design? Is there another approach I should take? All I'm
trying to do is add a simple conditional so, based on the contents of
one field, it will either display another field or display a default.
Simple enough.
Any ideas?
Regards,
David P. Donahue
ddonahue at ccs.neu.edu
More information about the Mono-list
mailing list