Seven price
asked on
programatic table with image
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.Ma pPath("ima ges"))
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("onclic k", "")
If sqlDR("UPC").ToString() + ".jpg" = word Then
img.ImageUrl = mypath + sqlDR("photonumber").ToStr ing() + ".jpg"
Else
img.ImageUrl = "images/blankimage.png"
End If
img.ID = "myNewimage" + cnt.ToString()
c.Controls.Add(img)
r.Cells.Add(c)
Next
End If
Next
newItem.Rows.Add(r)
Loop
Do While sqlDR.Read
Dim strFileSize As String = ""
Dim di As New IO.DirectoryInfo(Server.Ma
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("onclic
If sqlDR("UPC").ToString() + ".jpg" = word Then
img.ImageUrl = mypath + sqlDR("photonumber").ToStr
Else
img.ImageUrl = "images/blankimage.png"
End If
img.ID = "myNewimage" + cnt.ToString()
c.Controls.Add(img)
r.Cells.Add(c)
Next
End If
Next
newItem.Rows.Add(r)
Loop
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER