日期:2014-05-17 浏览次数:20473 次
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (Convert.ToString(e.Row.Cells[1].Text.Trim()) != "正常" && e.Row.Cells[19].Text != "True") { e.Row.Cells[2].BackColor = Color.Red; e.Row.Cells[2].Text="坏的"; e.Row.Cells[2].ImageUrl = "Images/huai.gif" } } }
ImageUrl='<%# GetUrl((bool)Eval("状态")) %>'
------解决方案--------------------
用模板,里面放个image控件。