Yes, I did. You can see the problem by looking at the sql generated (I left out the parms for clarity):
-- Fill the TypedList (using PageNumber and PageSize overloads)
CREATE TABLE #TempTable (
[__rowcnt][int] IDENTITY (1,1) NOT NULL,
[UserID][Int] NULL,
[UserFirstName][VarChar](20) NULL,
[UserMiddleName][VarChar](20) NULL,
[UserLastName][VarChar](20) NULL);
INSERT INTO #TempTable SELECT DISTINCT [dbo].[Log].[UserID] AS [UserID],[dbo].[Log].[UserFirstName] AS [UserFirstName],[dbo].[Log].[UserMiddleName] AS [UserMiddleName],[dbo].[Log].[UserLastName] AS [UserLastName] FROM [dbo].[Log] WHERE ( [dbo].[Log].[ActionID] = @ActionID1) ORDER BY [dbo].[Log].[UserLastName] ASC,[dbo].[Log].[UserFirstName] ASC
SELECT * FROM #TempTable WHERE [__rowcnt] > 0 AND [__rowcnt] <= 10;
Query returns 4 rows
-- Use TypedList.GetDBCount()
SELECT DISTINCT TOP 1 COUNT(*) AS [UserID]
FROM [dbo].[Log]
WHERE ( [dbo].[Log].[ActionID] = @ActionID1)
Query returns 5 as the count
The problem is that the table has an Identity primary key column. I get the correct DISTINCT result from the first query, which leaves that column out, but I get an extra row from the GetDBCount() query, because it's filtering on ALL rows instead of on the rows that are part of the TypedList. Technically, for custom DataGrid paging, things should work if I set
datagrid.VirtualItemCount = typedlist.Count
however, in some instances I found that TypedList.Count was returning incorrect results (for some reason if I set PageSize = 2 during fill, TypedList.Count came back as 2, even though there should have been 4 rows returned (maybe this is a different bug?).
Anyway, using TypedList.Count is working right now, but I don't feel that my paging is bullet-proof, and I hate to let things go out that way
So, any help you can provide would be great.