Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Gridview edit ItemTemplate

$
0
0

Hi, I have an ItemTemplate that gets a numeric value from <%# Bind("Retard") %>. If the value is negative I want the background to be Red, is positive I want the background to be Green. The data source is a DataTable, I dont want to loop the DataTable and write the HTML, I would like to know if I can do it inside the GridView, is it possible?

<asp:TemplateField HeaderText="Retard" SortExpression="Retard"><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("Retard") %>'></asp:Label></ItemTemplate></asp:TemplateField>

Example, the background color of the cells should be red or green:

Thanks



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>