Question : How to embed C# code in aspx page which is repeater?

Hi

I need to display an image according to the current system datetime and completedatetime which get from the DB. If it is less than 1 day, then display the image.

The following is the code, but it has compile error on 'if'.
Invalid expression term 'if'

How should I fix it?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
ASPX:


<%# if(this.CurDateTime - DataBinder.Eval(Container.DataItem, "completedatetime") <=1 ) 
{
Response.Write("");  
}
%>

 
C#:
protected System.DateTime CurDateTime;
private void Page_Load(object sender, System.EventArgs e)
{
            this.CurDateTime = System.DateTime.Now;
}

Answer : How to embed C# code in aspx page which is repeater?

You can evaluate the dates inline, this assumes the date is never DBNull...

Something like..
1:
2:
3:
4:
5:



 
Random Solutions  
 
programming4us programming4us