We help IT Professionals succeed at work.
Get Started

programatic table with image

Last Modified: 2012-05-12
below i am trying to compare the image names with the name in the database. but for some reason I only can read one image name but nothing after. I tried to split it. Not sure the correct syntax to get this working.

Do While sqlDR.Read
                Dim strFileSize As String = ""
                Dim di As New IO.DirectoryInfo(Server.MapPath("images"))
                Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")
                Dim fi As IO.FileInfo

                For Each fi In aryFi
                    If fi.Extension = ".jpg" then

                        strFileSize = (Math.Round(fi.Length / 1024)).ToString()

                        Dim s As String = fi.Name

                         Dim words As String() = s.Split(New Char() {" "c})
                        For Each word In words

                            Dim mypath = "images" + sqlDR("photonumber") + "/"
                            Dim mysunday As String = sqlDR("photonumber")
                            r = New TableRow ' << place here start new row
                            c = New TableCell ' << place here start new table cell
                            cnt = cnt + 1

                            img = New ImageButton
                            img.Width = "100"
                            img.Attributes.Add("onclick", "")
                            If sqlDR("UPC").ToString() + ".jpg" = word Then
                                img.ImageUrl = mypath + sqlDR("photonumber").ToString() + ".jpg"
                                img.ImageUrl = "images/blankimage.png"
                            End If
                            img.ID = "myNewimage" + cnt.ToString()

                    End If


Watch Question
Most Valuable Expert 2012
Top Expert 2008
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE