I am using the slideshowextender control to display images from database. I am using image handler to retrieve images from database. My problem is when i am using for loop to populate the slide for the slideshowextender images wont display but if i do a manual add to array it works. Below is the code for GetSlides
Did i miss something in my code?
Thank you.
VB.NET:
<System.Web.Services.WebMethod(), System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetSlides(ByVal contextKey As String) As AjaxControlToolkit.Slide()
'Return (imgSlide)
Dim propID As Long = CLng(contextKey)
Dim mTotolrows As Integer = 0
Dim mName As String = ""
Dim mDescription As String = ""
Dim propImageID As Long
Dim mDT As DataTable
mDT = mproperty.SelectPhotoRecByForeignKeyID(propID)
If mDT.Rows.Count Then
mTotolrows = mDT.Rows.Count - 1
Dim imgSlide As AjaxControlToolkit.Slide() = New AjaxControlToolkit.Slide(mTotolrows) {}
For mCount As Integer = 0 To mDT.Rows.Count - 1
mName = IIf(IsDBNull(mDT.Rows(mCount).Item("PhotoName")), "", mDT.Rows(mCount).Item("PhotoName"))
mDescription = IIf(IsDBNull(mDT.Rows(mCount).Item("Description")), "", mDT.Rows(mCount).Item("Description"))
propImageID = mDT.Rows(mCount).Item("PropertyPhotoID")
imgSlide(mCount) = New AjaxControlToolkit.Slide("~/ShowImage.ashx?id=" & propImageID, "test", "test")
Next
'below work when removing with out the for loop
'imgSlide(0) = New AjaxControlToolkit.Slide("ShowImage.ashx?id=2", "test", "test")
'imgSlide(1) = New AjaxControlToolkit.Slide("ShowImage.ashx?id=3", "tset", "test")
'imgSlide(2) = New AjaxControlToolkit.Slide("ShowImage.ashx?id=4", "tset", "test")
Return imgSlide
Else
Return Nothing
End If
End Function
Did i miss something in my code?
Thank you.