473,654 Members | 3,074 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 4317
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
1657
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
3436
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
3296
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
8290
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
8815
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8708
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
8489
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
8594
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7307
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...
0
5622
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1596
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.