Rank: Newbie Groups: Member
Joined: 6/1/2009 Posts: 7
|
Hi,
Is it possible to have a small picture (icon) displayed in a grid cell in the grid control? could you post a small code snippet?
Thanks
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Yes. You will need to use a StaticColumn and then set the StaticColumn's DataFormat to something like this:
This way your data is filled into as the Url of the image. Thanks!
|
Rank: Newbie Groups: Member
Joined: 5/25/2009 Posts: 7
|
EO,
if you are populating the grid from a database should you set the staticColumn to a field in the database that reads a url?
Thanks BobbyMax
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
For the example above, yes. But the point is that your data and the column's DataFormat together create the final HTML that get rendered into each cell. So however you arrange both is purely a matter to you. For example, you can store the final HTML in your database and set DataFormat to an empty string (so that the Grid takes whatever in your DB as is), or you can store the Url in your database and set DataFormat as an image tag as shown above, or you can store only the file name in your database and set DataFormat to include the path information. However you do it, those two work together to create the final output.
Thanks!
|