p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ADO.NET (http://p2p.wrox.com/forumdisplay.php?f=109)
-   -   to display an icon in datagrid (http://p2p.wrox.com/showthread.php?t=27129)

deeraj March 21st, 2005 08:04 AM

to display an icon in datagrid
I have a dataset which acts as a datasource to my datagrid. It just shows all the columns from a table. One of the columns is an image column. How do i show these icons\pictures on the grid?

My code looks like this:
dim cmd as sqlcommand
dim da as sqldataadapter
dim ds as new dataset

cmd.commandtext = "select * from tbl_auths"
cmd.connection = cn
'assuming connection (cn) to be open
da = New SqlDataAdapter(cmd)
dgrauth.datasource = ds.tables("tbl_auths")

swastikagaur March 24th, 2005 04:21 AM


for showing image in a datagrid there can b two approaches acc. to me :

1) u can create an 'image type' field in ur database and then make use
   of a bound column. But wot i feel is that this approach can make ur
   database too heavy. so to avoid this u can follow the 2nd app.
2) create an image folder in ur appln. directory.then u can use a
   template column and put an <img> tag there. This <img> tag will
   consist of the src of ur images folder along with the container
   for retrieving ur dataitems. Also ur database will contain an
   image column with any varchar/char datatype.

this shud solve it..
I knw it may sound a bit complicated .. but believe me it's easy :)


It bcums FATAL wen my brain puts my eyes on Call-Waiting ! >|B-)

deeraj March 24th, 2005 06:37 AM

The table uses an image column which contains some hexadecimal value. In the grid its coming as "Byte[]Array" instead of the real icons. Also my project is in VB.NET and not in ASP.NET. Does the concept of bound columns exist in VB.NET also? Please help

swastikagaur March 24th, 2005 08:06 AM


this link may b beneficial..


It bcums FATAL wen my brain puts my eyes on Call-Waiting ! >|B-)

deeraj March 30th, 2005 02:00 AM

Thanks for sending that link...But the problem is they are using an imagelist. I want it to come directly from the database. So that code wont work!

All times are GMT -4. The time now is 03:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.