Here is my code,
GridView1.Rows.Cells[j].Attributes.Add("Style", CalculateProgressBarValue(Convert.ToInt32(GridView1.Rows.Cells[j].Text), GridView1.Rows.Cells[j].Height.Value));
private String CalculateProgressBarValue(int verimlilik, double heightt)
{
String backGroundCss = null;
int margin = 0;
if (verimlilik < 109)
margin = -250 + Convert.ToInt16(verimlilik * (2.27)) - 5;
else
margin = 0;
if (verimlilik > Convert.ToInt16(75))
backGroundCss = "background: url(../Resources/green.png) no-repeat 0px center;background-position:" + margin.ToString() + "px 2px; ";
else if (verimlilik < Convert.ToInt16(50))
backGroundCss = "background: url(../Resources/red.png) no-repeat 0px center;background-position:" + margin.ToString() + "px 2px; ";
else
backGroundCss = "background: url(../Resources/gray.png) no-repeat 0px center;background-position:" + margin.ToString() + "px 2px; ";
return backGroundCss;
}