I would like to display an icon in a cell in a datagrid depending on the cell value. How do I do that?
HTML
<asp:BoundColumn Visible="true" DataField="FILE_ID" HeaderText="Milestone Type" HeaderStyle-CssClass="bodyTextBold" ItemStyle-CssClass="bodyText" HeaderStyle-Width="2%" ItemStyle-Width="2%" HeaderStyle-HorizontalAlign="Center" ></asp:BoundColumn>
Code Behind
for(int i=0;i<this.grdFocusItem.Items.Count;i++)
{
if(this.grdFocusItem.Items.Cells[14].Text.TrimEnd()
=="37")
{
this.grdFocusItem.Items.Cells[14] =<Display gif>
}
}
Also, I would like to set the color of a datarow depending on a condition. I tried cells.forecolor. It wont work. Backcolor works fine but. Iam using a generic css for this datagrid. i cannot modify the css as this rowcolor is a purelyy un time value.I do have something called CssClass. But how do I assign the forecolor?
HTML
<asp:BoundColumn Visible="true" DataField="FILE_ID" HeaderText="Milestone Type" HeaderStyle-CssClass="bodyTextBold" ItemStyle-CssClass="bodyText" HeaderStyle-Width="2%" ItemStyle-Width="2%" HeaderStyle-HorizontalAlign="Center" ></asp:BoundColumn>
Code Behind
for(int i=0;i<this.grdFocusItem.Items.Count;i++)
{
if(this.grdFocusItem.Items.Cells[14].Text.TrimEnd()
=="37")
{
this.grdFocusItem.Items.Cells[14] =<Display gif>
}
}
Also, I would like to set the color of a datarow depending on a condition. I tried cells.forecolor. It wont work. Backcolor works fine but. Iam using a generic css for this datagrid. i cannot modify the css as this rowcolor is a purelyy un time value.I do have something called CssClass. But how do I assign the forecolor?