I'm using a Data Repeater. I need to change font color based on the
value of a date field in the <itemtemplate>. Anyone know how this can
be done?
Micah
In your ASP/HTML code add
<ITEMTEMPLATE>
<ASP:TABLE id="tblData" runat="server">
<ASP:TABLEROW>
<ASP:TABLECELL FontColor='<%# FormatDate(DataBinder.Eval(Container,
"DataItem.DateColumn")) %>'>
<%# FormatDate(DataBinder.Eval(Container,
"DataItem.DateColumn")) %>
</ASP:TABLECELL>
</ASP:TABLEROW>
</ASP:TABLE>
</ITEMTEMPLATE>
where 'DateColumn' is the name of the column which holds your date value.
Then in your code behind file create a function that will return the color
you want based on the date:
Protected Function FormatDate(ByVal dteDate As Date) As
System.Drawing.Color
Dim c As System.Drawing.Color
If <PERFORM COMPARISON HERE> Then
Return c.AntiqueWhite <SELECT YOUR COLOR>
Else
Return c.White <SELECT YOUR COLOR>
End If
End Function
Obviously this code needs a little cleanup, but it should get you started in
the right direction.
Patrick Baker
VB .NET
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Micah" <micahb...@yahoo.com> wrote in message
news:a9c6259b.02070...@posting.google.com...