OT: DataBinding and If Logic

OT: DataBinding and If Logic

Old forum URL: forums.lhotka.net/forums/t/1088.aspx


david.wendelken posted on Thursday, August 31, 2006

I'm trying to do some runtime databinding on my aspx page and got some odd results, so I built a small test case.

<asp:Label ID="Label2" runat="server" Text='<%# Eval("EffDate") == Eval("EffDate") %>

Why would this evaluate to "False" when Eval("EffDate") has a value of "1/1/2006"?

In the absence of a solution, I'm moving the code to an event handler (assuming I find the right one).

ajj3085 replied on Thursday, August 31, 2006

I would guess Eval returns a new instance in each case, and the == is comparing the refernces, not the values.

david.wendelken replied on Thursday, August 31, 2006

The documentation says it returns a string, and when I display the value that's what I get.

Copyright (c) Marimer LLC