try<asp:Image ImageUrl="new.gif" Visible='<%# (DateTime.Pash(DataBinder.Eval(Container.DataItem, "AddedDate").ToString()) > DateTime.Now ) ? true:false
%>'></asp:Image>

解决方案 »

  1.   

    Visible='<%#chk(DataBinder.Eval(Container.DataItem,"AddedDate"))%>'在vb中写个判断函数  返回 ture/false:
            Public Function chk(ByVal strDate)
                Dim sOut
                If DateDiff(DateInterval.Day,strDate,Now)<2 Then
                    sOut = True
                Else
                    sOut = False
                End If
                chk = sOut
            End Function
      

  2.   

    为什么不在读取数据的时候进行判断啊?!where AddedDate >= dateadd(d,-2,getdate())
      

  3.   

    <asp:Image ImageUrl="new.gif" Visible='<%# ((DataBinder.Eval(Container.DataItem, "AddedDate").ToString()) > DateTime.Now ) ? true:false
    %>'></asp:Image>??
    DateTime.Pash --> DateTime.Parse
      

  4.   

    Push?  brightheroes想把人推下水?开个玩笑。试了,不行。 分析器错误: 外部组件发生异常答 ALong_Yue() ,只能在绑定的时候判断。
      

  5.   

    同意:jackie615(脑子进水了)在.cs里做一个函数。
    做判断可以。。
      

  6.   

    是否是DateTime.Now 这句有问题?
      

  7.   

    我用的是C#,没有 DateDiff 这个方法。
      

  8.   

    Visible='<%# DateTime.Now.Subtract(DataBinder.Eval(Container.DataItem,"AddedDate")).Days>2? true:false%>'>也不行
      

  9.   

    可以在数据库取数据时增加一个bit型字段IsNew来表示。我就是这样作的。