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 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 1st, 2007, 12:25 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 gridview image display


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" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
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;
27
28 </div>
29 </form>
30 </body>
31 </html>
32



Cheers
Sheraz
__________________
Cheers
Sheraz
Reply With Quote
  #2 (permalink)  
Old September 3rd, 2007, 12:37 AM
Registered User
 
Join Date: Aug 2007
Location: hyderabad, a.p, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
there should be a folder for images in ur application.the images should be there in that imagepath which u r getting when u run the application.
put a folder for the images and images must be there in that folder. store this images path in db.

Hope this works for u
GudLuck


Archu
Reply With Quote
Reply


Thread Tools
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 11:34 PM
how to display the GridView. kcsathish ASP.NET 2.0 Basics 1 July 23rd, 2008 05:08 AM
Display image in gridview Sheraz Khan ASP.NET 2.0 Professional 0 August 30th, 2007 11:36 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 03:23 AM



All times are GMT -4. The time now is 07:12 AM.


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