Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2007, 03:03 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default If Somebody is using Forums TBH VB read this

weird...

I don't know about you but I can't see posts after first page (with cacheEnabled)!
This only happen in VB.

One of the thread functions in Post Class is:

Code:
            Dim posts As List(Of Post) = Nothing
            Dim key As String = "Forums_Thread_" & threadPostID.ToString()

            If BaseForum.Settings.EnableCaching AndAlso Not IsNothing(BizObject.Cache(key)) Then
                posts = CType(BizObject.Cache(key), List(Of Post))
            Else
                Dim recordset As List(Of PostDetails) = SiteProvider.Forums.GetThreadByID(threadPostID)
                posts = GetPostListFromPostDetailsList(recordset)
                BaseForum.CacheData(key, posts)
            End If

            Dim count As Integer = maximumRows
            If posts.Count < startRowIndex + maximumRows Then count = posts.Count - startRowIndex
            Dim array As Post()
            ReDim array(count - 1)
            posts.CopyTo(startRowIndex, array, 0, count) ' was count
            posts.Clear()
            posts.AddRange(array)
            Return posts
After some time trying understand, the line "Post.Clear" update the cache! If the post.count was "15" after the first the count will be updated to the MaximumRows...

I changed to:
Code:
            Dim count As Integer = maximumRows
            If posts.Count < startRowIndex + maximumRows Then count = posts.Count - startRowIndex
            'Dim array As Post()
            'ReDim array(count - 1)
            'posts.CopyTo(startRowIndex, array, 0, count) ' was count
            'posts.Clear()
            'posts.AddRange(array)
            Return posts.GetRange(startRowIndex, count)
And it worked...
Beside I don't understand why marco used posts.CopyTo when he could simply used posts.GetRange

Doesn't C# have list.rangeTo(startIndex, count) ?

I hope it helped someone






Similar Threads
Thread Thread Starter Forum Replies Last Post
TBH Starter Kit forum on ASP.NET Forums rocco50 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 March 5th, 2007 01:53 PM
Buiding Forums in ASP.NET and VB.NET saif44 ASP.NET 1.0 and 1.1 Professional 3 November 2nd, 2006 01:52 PM
Suggestion - Create Separate Forums for VB and C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 September 8th, 2006 03:12 PM
Opening word document read only in VB StevenVints VB How-To 1 May 3rd, 2006 09:52 AM
Why use VB.Net to read Access? AmyEL VB.NET 2002/2003 Basics 3 February 24th, 2005 12:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.