Set GridView Value ItemStyle ForeColor based on Row/Column Value
<p>I have an ASP.net GridView that spits out three columns of data: (OrderNumber, OrderStatus, and OrderDate).</p>

<p>I want to set the OrderStatus Field Value = RED IF the status = "Cancelled"</p>

<p>I am not sure how to look at the value of that field for each row of the output and determine if the status is Cancelled...then if it is set the color to RED.</p>

<p>ASP.net GridView:</p>

<pre><code>&lt;asp:GridView ID="gvOrders" 
                     runat="server" 
                     AutoGenerateColumns="False"
                     GridLines="None"  
                     AllowPaging="true" 
                     CssClass="mGrid"  
                     PagerStyle-CssClass="pgr"  
                     AlternatingRowStyle-CssClass="alt" &gt; 
           &lt;Columns&gt;
             &lt;asp:BoundField DataField="OrderNumber" HeaderText="OrderNumber" SortExpression="OrderNumber" /&gt;
             &lt;asp:BoundField DataField="OrderStatus" HeaderText="OrderStatus" SortExpression="OrderStatus" /&gt;
             &lt;asp:BoundField DataField="OrderDate" HeaderText="OrderDate"  SortExpression="OrderDate" /&gt;
           &lt;/Columns&gt;
       &lt;/asp:GridView&gt;
</code></pre>

<p>C# DataBinding: </p>

<pre><code>protected void navOrders_Onclick(object sender, BulletedListEventArgs e)
{
    switch(e.Index)
    {
        case 0: //Orders
            DataTable dt = Procedures.GetOrderData();

            gvOrders.DataSource = dt;
            gvOrders.DataBind();

            break;
    }

}
</code></pre>

<p>Any suggestions would be greatly appreciated.</p>

<p>Thanks as always,</p>

<p>S</p>
