473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

is it possible to display image in gridview

Dear All,

I am using asp.net2.0, sql 2005
I am storing Image url in database. through that url i would like to show images in gridview
I want to know is it possible to show images in gridview.
Please guide me or give me some useful link.
Thanks
Jul 4 '07 #1
1 1716
gwtech
3
First off store your pics in a folder!
Just save the name in the db. Saving pics to the db can bloat it quickly.
[please refrain from advertising your services on this forum]

This code is the Master Detail with photo for my system.

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="PictureID"
DataSourceID="SqlDataSource1" Height="50px" Width="885px" CellPadding="4" ForeColor="#333333" GridLines="None">
<Fields>
<asp:BoundField DataField="PictureID" HeaderText="PictureID" InsertVisible="False"
ReadOnly="True" SortExpression="PictureID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:ImageField DataImageUrlField="PictureURL" HeaderText="Photo">
</asp:ImageField>
<asp:TemplateField HeaderText="Dog Info" SortExpression="DogInfo">
<EditItemTemplate>
<asp:TextBox ID="DogInfo" runat="server" Rows="8" Text='<%# Bind("DogInfo") %>' TextMode="MultiLine"
Width="456px"></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DogInfo") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemStyle Width="600px" />
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("DogInfo") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="URLSource" HeaderText="Link" SortExpression="URLSource" />
<asp:BoundField DataField="DateUploaded" HeaderText="Created On" ReadOnly="True"
SortExpression="DateUploaded" />
<asp:BoundField DataField="Contact" HeaderText="Contact" SortExpression="Contact" />
<asp:BoundField DataField="UEmail" HeaderText="Contact Email" SortExpression="UEmail" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="FileSize" HeaderText="FileSize" ReadOnly="True" SortExpression="FileSize" />
<asp:BoundField DataField="Updated" HeaderText="Updated" ReadOnly="True" SortExpression="Updated" />
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
</Fields>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#FFFFC0" Font-Bold="True" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView><br />

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="PictureID" DataSourceID="PicturesDataSource"
Width="885px" PageSize="4">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowSelectButton="True" ButtonType="Button" />
<asp:BoundField DataField="PictureID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="PictureID" />
<asp:BoundField DataField="Name" HeaderText="Dog's Name" SortExpression="Name" />
<asp:BoundField DataField="DogInfo" HeaderText="Dog's Info" SortExpression="DogInfo" />
<asp:ImageField DataImageUrlField="PictureURL" HeaderText="Photo">
</asp:ImageField>
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="Contact" HeaderText="Contact" SortExpression="Contact" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:BoundField DataField="Updated" HeaderText="Updated (Date)" SortExpression="Updated" />
</Columns>
</asp:GridView>
Jul 21 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tan | last post by:
Hi I am desperate for any help with display image in Gridview I have a gridview contain surname , forename ..... and image. I could not display image as my database store the column image as...
0
by: Joey | last post by:
Hello all, I am trying to read a directory listing into a string and then use that data, along with some other data, to create HTML for display in a gridview row. A sample item in the string...
4
by: Guy | last post by:
I'm a little bit confused as what is the bes way to achieve the following: I have 2 database tables, table 1 product en table 2 image. For every product record there can be 0-1 or more image...
18
by: Auto | last post by:
Hello, I would like to know how do display an image into a Gridview (ASP.NET 2.0) taken directly from a DataBase, NOT using an URL, like described in this article: ...
2
by: Jack | last post by:
Hello, I've got the Gridview control working displaying two fields from my database, but the fields are displayed horizontally next to each other. How can I display my 'Text' underneath my...
2
by: Dale | last post by:
This seems like it should be simple and I am pretty sure I've done similar things a hundred times before but I sure can't seem to get it right this time. I have a GridView with a column of text...
1
by: tuman | last post by:
I am making a project which is related to classified web site. I have used a gridview control. In which put some sqltable data. And i want to show a image which is store in my project folder,...
2
by: bogdan | last post by:
Hi, Can a single GridView be 'connected' to DetailsView that renders itself differently based on the currently selected row? I have a GridView with rows that could be displayed in the same way...
23
by: shashi shekhar singh | last post by:
Dear sir, I have a word document file contains text and images, now i have saved it as a web page and wants to display it on browser , using , string str=directory.getfiles("");...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.