ASP.NET Repeater - Evaluate Item as int?
- by WedTM
I'm trying to style a table row based upon a value in the databound collection (from LINQ to SQL) in my item template, however it's not working.
This is what I have so far:
<ItemTemplate>
<%
string style = String.Empty;
if ((string)DataBinder.Eval(Quotes.Cu, "Status") == "Rejected")
style = "color:red;";
else if ((string)Eval("Priority") == "Y")
style = "color:green;";
if (style == String.Empty)
Response.Write("<tr>");
else
Response.Write("<tr style=\"" + style + "\"");
%>
<td>
<%# Eval("QuoteID") %>
</td>
<td>
<%# Eval("DateDue", "{0:dd/MM/yyyy}") %>
</td>
<td>
<%# Eval("Company") %>
</td>
<td>
<%# Eval("Estimator") %>
</td>
<td>
<%# Eval("Attachments") %>
</td>
<td>
<%# Eval("Employee") %>
</td>
</tr>
</ItemTemplate>