August 4, 2005 at 4:20 am
Hi,
Is there a way of replacing data with icons in a databound grid?
I am using a grid control (currently exontrol's as it has built in editor functions) to pull a recordset and display it. What I need to do is have it display a status icon in column 1, (much like Outlook has the flag, attachment icons etc). AT the moment I have to populate the recordset from SQL server with a number from 1 to 4 for the status and then add a column to the grid, assign an icon and then hide the numeric column.
Is there a better way? Having images stored in the DB, that get pulled staright into display? Pull the database into an array and manually filling a grid?
Any pointers gratefully received.
Colin
August 4, 2005 at 3:32 pm
I would think the easiest way would be to create a new table in your database with only the numbers 1-4 and their corresponding images (or even path to images, if you'd rather). Then you pull the images directly out of the database by joining the tables, and you only end up having to store them once.
Could be wrong, just the first thing that comes to mind. Good luck!
August 5, 2005 at 9:39 am
Colin, it really depends on the specifics of the tools you are using. Is you application a Windows app or a Web app? Are you using the built in Datagrid control that comes with Visual Studio or a third-party control?
The ASP.Net data grid control raises the ItemDataBound event, which allows you examine the contents of each row of the grid after the data is bound to it but before it is displayed -- this makes it fairly easy to substitute a graphic for the data that has been bound to any particular column in the row.
I can't speak to other tools/environments, but there may be something similar in the tools you are using. Good Luck!
August 6, 2005 at 2:10 pm
Thanks for your opinions.
I am writing a Windows app using VB6, I looked at the standard Microsoft grids, but they didn't have all of the features I needed.
I have ended up with the Exontrol ExGrid (http://www.exontrol.com/exgrid.jsp) it has built in cell editors, formatting of data and sorting on multiple columns. It also supports multiple icons per cell, multi column tree formats and databinding!
I have gone back to opening a recordset, setting through the records and adding the data column by column, harder to code but seems to update a lot quicker and stabler than binding to a recordset and then changing 1500 rows.
Colin
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply