how to load image in gridview

how to load image in gridview from msaccess database

Page 1 of 1

1 Replies - 12439 Views - Last Post: 21 May 2009 - 05:02 AM Rate Topic: -----

#1 vikramjit  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 24-December 08

how to load image in gridview

Posted 20 May 2009 - 02:03 PM

<asp:GridView ID="gridview1" runat="server" AutoGenerateColumns="False" style="Z-INDEX: 107; LEFT: 300px; POSITION: absolute; TOP:200px; font-size:10pt; " >
<Columns>
<asp:BoundField DataField="id" HeaderText="UserId" />
<asp:BoundField DataField="ProdName" HeaderText="productname" />
<asp:ImageField DataImageUrlField='~/image/ <% # Eval("ImageName") %>.jpg' HeaderText="image"></asp:ImageField>
</Columns>
	 </asp:GridView> 
 



with this code id & product name showed in asp.net page but image is not comming , i am getting error
"A field or property with the name '~/image/ <% # Eval("ImageName") %>.jpg' was not found on the selected data source. "

i am using msaccess for database


so plz suggested anything

Is This A Good Question/Topic? 0
  • +

Replies To: how to load image in gridview

#2 Saludalabs  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 5
  • Joined: 07-April 09

Re: how to load image in gridview

Posted 21 May 2009 - 05:02 AM

Hi, I use a template field with my grid to for a thumbnail to my gallery edit functions. I also included a field to hold the image name. Here is a little bit of code.

		<asp:TemplateField HeaderText="ThumbNail" SortExpression="imagename">
					<EditItemTemplate>
						<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("imagename") %>'></asp:TextBox>
					</EditItemTemplate>
					<ItemTemplate>
						<asp:Image Width="50" Height="50" ID="thumb1" runat="server" ImageUrl ='<%# "../gallery/thumb_" + Eval("imagename") %>'></asp:Image> 

					</ItemTemplate>
				</asp:TemplateField>




SaludaLabs





View Postvikramjit, on 20 May, 2009 - 01:03 PM, said:

<asp:GridView ID="gridview1" runat="server" AutoGenerateColumns="False" style="Z-INDEX: 107; LEFT: 300px; POSITION: absolute; TOP:200px; font-size:10pt; " >
<Columns>
<asp:BoundField DataField="id" HeaderText="UserId" />
<asp:BoundField DataField="ProdName" HeaderText="productname" />
<asp:ImageField DataImageUrlField='~/image/ <% # Eval("ImageName") %>.jpg' HeaderText="image"></asp:ImageField>
</Columns>
	 </asp:GridView> 
 



with this code id & product name showed in asp.net page but image is not comming , i am getting error
"A field or property with the name '~/image/ <% # Eval("ImageName") %>.jpg' was not found on the selected data source. "

i am using msaccess for database


so plz suggested anything

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1