473,594 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using anchor with DataList (asp.net 2.0 with VB)

Hello, I have created a photo gallery of thumbnails using the code below.
So far, I got the pictures to show, but now I need to figure out how a
viewer can click on the thumbnail and it opens the bigger picture. The
bigger file is the same name as the file stored in the array minus the
"_mini". So in the datalist, I would need to somehow wrap the image inside
of the anchor. Any help with this would be appreciated.

Thanks in advance

File
photo01.jpg (larger jpg)
photo01_mini.jp g (thumbnail)

Code Behind
-----------
Sub GetFiles(ByVal str00 As String)

Dim FileArray() As String
Dim arrFileList As ArrayList = New ArrayList()
Dim Item As String, strFileName As String = ""

ctrFor = 0
FileArray = Directory.GetFi les(Server.MapP ath(str00), "*mini.jpg" )

'-- Iterate the array items and display files
For Each Item In FileArray
strFileName = str00 & "/" & Mid(Item, InStrRev(Item, "\") + 1)
arrFileList.Add (strFileName)
Next

'Populate Repeater Control
arrFileList.Tri mToSize() ' Trim the list
Me.dlstPhotoGal lery.DataSource = arrFileList
Me.dlstPhotoGal lery.DataBind()

End Sub
ASP.NET 2.0 Page
----------------
<asp:DataList id="dlstPhotoGa llery" Runat="Server"
GridLines="Both "
CellPadding="1"
CellSpacing="3"
RepeatColumns=" 3"
RepeatDirection ="Horizontal ">
<ItemTemplate >
<asp:Image ID="imgPhotoGal lery" ImageUrl='<%# Container.DataI tem %>'
Runat="Server" />
</ItemTemplate>
</asp:DataList>
Feb 6 '06 #1
1 4316
Hi sck10,

Welcome to the ASPNET newsgroup.

As for the displaying image thumbnails in DataList control with links to
their actual image, I think you can consider the following means:

1. Just embed the html <a> element in DataList's ItemTemplate together with
the Image control (wrapper it), e.g:

<asp:DataList ID="DataList1" runat="server">
<ItemTemplate >
<a href="http://www.asp.net">
<asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/tim.JPG" />
</a>
</ItemTemplate>
</asp:DataList>

2. The ASP.NET HyperLink control support both NavigationUrl and ImageUrl
properties, and the ImageUrl property can help display an image for the
hyperlink. You can set the NavigationUrl to the actual image of the certain
thumbnail item.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Feb 7 '06 #2

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

Similar topics

1
1654
by: mahsa | last post by:
H data I'm binding to the DataList is information about products in my product database. Perhaps passed in the QueryString to this page is a ProductID. I might want to make the item in the DataList that has the corresponding ProductID selected. In a similar vein, perhaps I want to have newest product selected by default. How can I acheieve this functionality actuly i use pagin <%@ Page language="c#" Codebehind="product.aspx.cs"...
2
3430
by: Hans Merkl | last post by:
Hi, I am trying to use a user control as EditItemTemplate in a DataList. It loads fine but I can't figure out how to bind to the data of the DataList. Here is what I have got so far: //Page_load of my user control protected void Page_Load(object sender, EventArgs e) { IDataItemContainer DataContainer = this.Parent as
3
2855
by: vishnu | last post by:
Hi, I have a link that is coming from the database.Now if the link is empty i dont want to display in datalist .How can i do that? <td><asp:DataList id="DataList1" Runat="server" RepeatDirection="Horizontal" RepeatColumns="3" CellPadding="5" CellSpacing="2" Width="100%" EnableViewState="False"> <itemtemplate> <b>
7
3289
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server...
0
7947
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7880
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8374
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8010
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6665
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1217
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.