Advertisement

04.03.2008 at 04:55AM PDT, ID: 23292444
[x]
Attachment Details

ASP.NET Server MapPath

Asked by lrbrister in .Net Editors & IDEs, Visual Studio .NET 2005

I have some vb code that gets data(image filenames) from a sql table and loads images.

What I need to do is to do this from a file list in a folder...instead of the table

example request.Params("offerID")   = 100100 (Example)

The file names are 100100_01.jpg, 100100_02.jpg, 100100_03.jpg...etc and are in a offersImages folder.

Code that works is attached.

The file

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
Dim fRows As DataRow()
Dim row As DataRow
fRows = dt.Select("DefaultImage = 1")
For Each row In fRows
phDefaultImage.Controls.Add(New LiteralControl("<img src=destinationimages/" & row("ImageSrc") & " id=""imgCurrent"" width=350 height=212>"))
Session("ImgDefault") = row("ImageSrc")
Next row
 
        Dim row2 As DataRow
        Dim Count As Integer
        Dim rowCount As Integer
        rowCount = 0
        Count = 1
        Dim iImgCount As Integer = 0
        iCurrentImage = 1
        'Dim ctrl
 
        phGalleryImages.Controls.Add(New LiteralControl("<tr>"))
        phGalleryImages.Controls.Add(New LiteralControl("<td width=62>"))
        For Each row2 In dt.Rows
            phGalleryImages.Controls.Add(New LiteralControl("<img id=""imgNav" & iImgCount + 1 & """style=""CURSOR:pointer;border-style:solid;border-width: 1px;border-color:#FFFFFF"" onclick=""otDisplayImage(this);otStopSlideShow();"" width=""55"" height=""38"" src=""destinationImages/" & row2("ImageSrc") & """ cIdx=""" & iImgCount + 1 & """>"))
            rowCount = rowCount + 1
            If rowCount = 5 Then
                phGalleryImages.Controls.Add(New LiteralControl("</td></tr><tr><td colspan=5 height=5></td></tr><tr><td width=62>"))
                rowCount = 0
            Else
                phGalleryImages.Controls.Add(New LiteralControl("</td><td width=62>"))
            End If
            iImgCount = iImgCount + 1
            m_sJavaScript &= vbTab & vbTab & "gImages[" & CStr(iImgCount - 1) & "]  = otAddImgStruct('destinationImages/" & row2("ImageSrc") & "','""','""');" & vbCrLf
 
        Next
[+][-]04.03.2008 at 06:01AM PDT, ID: 21272095

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Visual Studio .NET 2005
Sign Up Now!
Solution Provided By: Dhaest
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.03.2008 at 06:14AM PDT, ID: 21272229

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906