473,563 Members | 2,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image gallery with DataGrid

Hi everyone!

I want to do da Image gallery using just the datagrid, this one will dilpays
only images, no text, that means that it will have about 4 Collumns that will
displays just images from the same database table, from the same collumn of
the table. However I could not reproduce this, since each Row (with 4
collumns) displays 4 times the same image. How can i fix it?

here is a part of the code:

<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:Image Runat='server' ID='thumb' Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image1" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image2" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image3" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>

Just not to post other topic: The datasource of this datagrid is "created"
when the user clicks on the button of an Album. Since an Album can contains
many photos, I'll use paging in this datagrid, however when I click on the
pagers, the datagrid disspears.

Code:

Dim cm As New Data.OleDb.OleD bDataAdapter("S ELECT id, [path],[desc] FROM
fotos WHERE [album]=?", cn)
'' Dim ds As New Data.DataSet
cm.SelectComman d.Parameters.Ad d("album", ddlAlbum.Select edValue)
ds.Clear()
cn.Open()
cm.Fill(ds)
cn.Close()
' Stop
dgImg.DataSourc e = ds
dgImg.DataBind( )

The PageIndexChange d event is also done:
If e.NewPageIndex >= 0 Then
dgImg.CurrentPa geIndex = e.NewPageIndex
dgImg.DataBind( )
End If
Any help would be very apprecciated.

Thanks in advance
Nov 19 '05 #1
1 2211
Hi there,

In order to page datagrid, you have to rebind the datagrid's data source.

dgImg.CurrentPa geIndex = e.NewPageIndex
dgImg.DataSourc e = ds
dgImg.DataBind( )

The ds can be got either by requering DB, or in the first query to save ds
in Session, then retrieve it from Session.

If you have more questions, please let us know.

HTH

Elton Wang
el********@hotm ail.com


"ltt19" wrote:
Hi everyone!

I want to do da Image gallery using just the datagrid, this one will dilpays
only images, no text, that means that it will have about 4 Collumns that will
displays just images from the same database table, from the same collumn of
the table. However I could not reproduce this, since each Row (with 4
collumns) displays 4 times the same image. How can i fix it?

here is a part of the code:

<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:Image Runat='server' ID='thumb' Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image1" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image2" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
<asp:Image Runat='server' ID="Image3" Width='140' Height='110' ImageUrl='<%#
DataBinder.Eval (Container.Data Item, "path") %'></asp:Image>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>

Just not to post other topic: The datasource of this datagrid is "created"
when the user clicks on the button of an Album. Since an Album can contains
many photos, I'll use paging in this datagrid, however when I click on the
pagers, the datagrid disspears.

Code:

Dim cm As New Data.OleDb.OleD bDataAdapter("S ELECT id, [path],[desc] FROM
fotos WHERE [album]=?", cn)
'' Dim ds As New Data.DataSet
cm.SelectComman d.Parameters.Ad d("album", ddlAlbum.Select edValue)
ds.Clear()
cn.Open()
cm.Fill(ds)
cn.Close()
' Stop
dgImg.DataSourc e = ds
dgImg.DataBind( )

The PageIndexChange d event is also done:
If e.NewPageIndex >= 0 Then
dgImg.CurrentPa geIndex = e.NewPageIndex
dgImg.DataBind( )
End If
Any help would be very apprecciated.

Thanks in advance

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
502
by: Perttu Pulkkinen | last post by:
Does anybody know a php-based image gallery, where final looks of the actual site would not be determined by the application? I mean that there would only be a php-library of objects/functions that could be used to incorporate folders and images to any kind of website with personal appearance. (Of course administration application should be...
8
4796
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client clicks the "gallery" link, a cgi script could search the gallery/ dir, and create thumbnails of any jpeg images that don't already have a thumbnail...
13
2338
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't reached yet (I have gone all the way to page 50 on Google's results!!). Here are my requirements: • I have a DataGrid. Everything will be done from...
10
2224
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however many rows it takes) in order to create a basic thumbnail gallery. I can query and output the data as a single column table, but I'm having problems filling up a 3 column table (with different...
4
1787
by: RE Kochanski | last post by:
I have attempted to use the CSS techniques from two or three sites to create a CSS only image gallery. I am muddling the affair by placing the thumbnails in one float, the page text in another float, then using absolute positioning (and z-index) to display the image over the second float. The CSS for the thumbnails is from "Web...
1
2291
by: gescom | last post by:
My goal is to create essentially two galleries on a single page, in which the first gallery determines what the second gallery displays. For instance, the first gallery refers to the contents of the main image folder. The second gallery would be a folder inside the main image folder. Depending on which image is displayed, the first gallery's...
0
4189
by: numbnutz | last post by:
Hi, I am currently working on an XML Gallery for my girlfriend's brother who is a photographer. I have created a flash front end template and am using an XML database to load the images and accompanying captions. The gallery has more than one image and the user can navigate the gallery by clicking forward and backward buttons to take then...
5
2106
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers to an external javascript file which I have included the code to below: The file name is imgriders.js - as referred to in source of the html file above. if (document.images) { image1 = new...
10
6744
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE from Netscape. IE is ok but the Netscape browser including Firefox and Safari are not working now. Not sure why. The idea is that when you mouseover...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.