Welcome Guest Search | Active Topics | Sign In | Register

Picture in grid cell Options
ms
Posted: Thursday, June 4, 2009 5:44:30 PM
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
eo_support
Posted: Thursday, June 4, 2009 5:48:04 PM
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:

Code: HTML/ASPX
<img src="{0}" />


This way your data is filled into as the Url of the image.

Thanks!
BobbyMx
Posted: Thursday, June 4, 2009 7:46:10 PM
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
eo_support
Posted: Thursday, June 4, 2009 7:51:34 PM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.