Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 30th, 2007, 10:36 PM
Authorized User
Points: 395, Level: 6
Points: 395, Level: 6 Points: 395, Level: 6 Points: 395, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2007
Location: London, , United Kingdom.
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default Display image in gridview


I am trying to display the Picture field of the table categories from the Northwind database. I have tried to do it by both ways:

Using the Templete Field ( by placing the image control).
By adding a new column and then bind it from the Picture field of the categories table.
But both methods only show the path of the image but didn't actually load the image, donno why...?

The code through adding a new column (selecting type: image field and Bound field: picture ) is given bellow:

1 <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DisplayPictire.aspx.vb" Inherits="GridViewRetriefValues.DisplayPictire" %>
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" >
6 <head runat="server">
7 <title>Untitled Page</title>
8 </head>
9 <body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
13 SelectCommand="SELECT [CategoryID], [CategoryName], [Description], [Picture] FROM [Categories]">
14 </asp:SqlDataSource>
15 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"
16 DataSourceID="SqlDataSource1" Style="position: relative">
17 <Columns>
18 <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" InsertVisible="False"
19 ReadOnly="True" SortExpression="CategoryID" />
20 <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
21 <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
22 <asp:ImageField DataImageUrlField="Picture">
23 </asp:ImageField>
24 </Columns>
25 </asp:GridView>
26 &nbsp; &nbsp;
28 </div>
29 </form>
30 </body>
31 </html>


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload image-create & save thumbnail-display image angshujit ASP.NET 2.0 Professional 6 July 11th, 2013 10:34 PM
how to display the GridView. kcsathish ASP.NET 2.0 Basics 1 July 23rd, 2008 04:08 AM
gridview image display Sheraz Khan ASP.NET 2.0 Basics 1 September 2nd, 2007 11:37 PM
GridView doesn't display bnorg ASP.NET 2.0 Professional 1 December 1st, 2006 10:14 PM
How to Display the image from the image field. mikeparams SQL Server 2000 1 October 29th, 2004 02:23 AM

All times are GMT -4. The time now is 01:34 PM.

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