Hi I can search all the images with .jpg extension and pass it to the fancybox gallery , The issue is i just want the images of particular productid for instance if a product has 5 images , and they are saved as (productid_imagenumber.jpg) , therefore a product with productid 99 will be saved as 99_1.jpg , 99_2.jpg similarly 99_5.jpg, I can pass the productID but i cant find a away just to get the images of that productID , instead of getting all the images which is done by the function below:
Dim directory As DirectoryInfo = New System.IO.DirectoryInfo("C:Images")
Dim allImages() = directory.GetFiles("*.jpg", SearchOption.AllDirectories)
Dim strContent As String = ""
For Each image As FileInfo In allImages
Dim strTemp As String = (String.Format("<img src=""{0}"" />", image.Name))
strContent = "<a class=""fancybox-thumb"" rel=""fancybox-thumb1"" href=""" & image.Name + image.Extension & """ title="""">" & _
"<img src=""" & image.Name + image.Extension & """ alt="" /></a>"
Next
If Not String.IsNullOrEmpty(strContent) Then
Return String.Format("<div id=""product-lightbox""><p>{0}</p></div>", strContent)
Else
Return String.Empty
End If
End Function
任何人都可以就如何这样做提出任何建议或协助。