Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 21st, 2005, 08:04 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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)
da.Fill(ds,"tbl_auths")
dgrauth.datasource = ds.tables("tbl_auths")
  #2 (permalink)  
Old March 24th, 2005, 04:21 AM
Authorized User
 
Join Date: Mar 2005
Location: , , India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hy,

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 :)

ciao...

It bcums FATAL wen my brain puts my eyes on Call-Waiting ! >|B-)
  #3 (permalink)  
Old March 24th, 2005, 06:37 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #4 (permalink)  
Old March 24th, 2005, 08:06 AM
Authorized User
 
Join Date: Mar 2005
Location: , , India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hy,

this link may b beneficial..
"http://www.vbdotnetforums.com/showthread.php?t=2124"

hth..
ciao..

**************************************************
It bcums FATAL wen my brain puts my eyes on Call-Waiting ! >|B-)
  #5 (permalink)  
Old March 30th, 2005, 02:00 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid icon in Toolbox in VB.NET 2005 dimeanel Visual Basic 2005 Basics 1 April 12th, 2006 09:38 PM
Display icon on a webpage rroohhiitt C# 3 February 24th, 2006 08:12 PM
Display icon and form caption vickyj Beginning VB 6 1 January 31st, 2006 05:55 AM
Selectively showing an icon in datagrid GuyB ASP.NET 1.0 and 1.1 Basics 3 November 25th, 2005 01:19 AM
Datagrid display deadrocker .NET Web Services 1 February 12th, 2005 07:04 AM





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