Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS IntraWeb Component Pack Pro
TTIWDBAdvWebGrid: How to display an image based on the original cell value
TTIWDBAdvWebGrid: How to display an image based on the original cell value
You can use the OnGetCellData event to display a custom value based on the original cell value. As you can''t change the column type on the fly, you must add an IMG tag with a direct link to the image file.
Example:
procedure TIWForm1.TIWDBAdvWebGrid1GetCellData(Sender: TObject; RowIndex, ColumnIndex: Integer; var AValue: string); begin if AValue = 'X' then AValue := '<img src="/files/image.png">' end;
Follow these steps to display image from an ImageListin the TIWAdvWebGrid:
- Assign the ImageList to the TIWDBAdvWebGrid.Images property.
- Set the Columns[].ColumnType to ctDataImage.
- Set the index of the Image in the ImageList as the cell value.