Walaa wrote:
To bind to a dataTable you can use ObjectDataSource.
Hi,
but using an object datasource means a fair amount of coding for Data paging,
and having to use its own way, and it always seems to cry about not being able to find a method when the method is there all present & correct with the right signature. Now in my new method I have quite an easy time of it..
Public Function GetImages(ByVal iSectionID As Integer, ByVal iPageNum As Integer) As ImagesCollection
Dim i As Integer = iPageNum
If i = 0 Then
i = 1
Else
i = i + 1
End If
Dim ImageTable As New ImagesCollection()
Dim ImageFilter As IPredicateExpression = New PredicateExpression()
ImageFilter.Add(ImagesFields.SectionId = iSectionID)
ImageTable.GetMulti(ImageFilter, 0, Nothing, Nothing, i, 12)
Return ImageTable
End Function
Now from what I can gather using this code and looking at the SQL Profile this is actually paging correctly and hence is doing what i wanted it to do. As the UI page is only for read only I do not need 2 way data binding so its ok. What I had not worked out was that you can set the page size in the LLBL calling code and then just pass it a page number and the rest I guess is magic
This works really well with a datalist as it doesnt have any paging built in, so I keep the page number in my page and then use the above function to page the data.
Not sure if its the right way, but its working...any comments would be good.
I also use this function to get the total record count
Public Function GetImageCount(ByVal iSectionID) As Integer
Dim i As Integer
Dim ImageTable As New ImagesCollection()
Dim ImageFilter As IPredicateExpression = New PredicateExpression()
ImageFilter.Add(ImagesFields.SectionId = iSectionID)
i = ImageTable.GetDbCount(ImageFilter, Nothing)
ImageTable = Nothing
ImageFilter = Nothing
Return i
End Function
Thanks every body...and sorry If i am being silly, I'm just a bit of noob some days.
Jason