Wednesday, November 21, 2012

highlighting gridview column cell color in asp.net



protected void GDVHistory_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string amtsigh = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Payment_Amt"));
            string minus = amtsigh.Substring(0, 1);
            if (minus == "-")
            {
                e.Row.Cells[2].ForeColor = System.Drawing.Color.Red;
            }

        }
    }

No comments:

Post a Comment