We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Displaying icons based on a value in a particular row...

I want to diplay an icon next to a value in a GridDataBoundGrid control much like you see in the windows Event Viewer. Like the windows event viewer i need to have multiple columns of data and the first column will display 1 of 3 icons based on the type of row it is... if it's an error then display a red x, if it's informational display the information icon, etc. i've noticed that the MultipleView and GridListControl samples provide this functionality, but there is no equivelant for a GridDataBoundGrid control. what would be the best strategy for accomplishing this? keeping in mind that the grid could hold 5,000 rows so how it handles it in memory is crucial.

1 Reply

AD Administrator Syncfusion Team March 11, 2003 06:35 AM UTC

Add an ImageList to your project holding the three icons. Then handle the PrepareViewStyleInfo event. In that event, if e.RowIndex > 0 and e.ColIndex is 1 (the col where you want the icon), then set e.Style.ImageList to be your imagelist, and e.Style.ImageIndex to be the index of the icon you want to use for the given row, e.RowIndex. If you need to test values from columns other than e.ColIndex, you can get them by using indexers on the GridDataBoundGrid. If you need to know the value of the e.ColIndex cell, then get it from the e.Style.CellValue.

Loader.
Live Chat Icon For mobile
Up arrow icon