Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display an ICON in a datagrid-Help!

Status
Not open for further replies.

aspengal

Technical User
Dec 27, 2004
41
US
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top