BUG : Datagrid ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have come across a situation which appears to be a BUG
with the DataGrid control (asp:datagrid)

Following the application of a fliter on a PostBack, it
seems the total number of items (dgItems.Items.Count) of
the control varies depending on its page size ?

What prompted me to look this in more depth is that 2
pages show at the bottom of the grid and when the user
clicked on the '2' to get to the second page, nothing
happens.

I initially had a data grid with a page size of 8 and a
filter which filters the datagrid down to 8 items.

Theoretically, if there are 8 items (rows) and a page
size of 8, the page should not display pages...? First
problem.

If I change the page size to 9, the number of items now
displayed by the datagrid is 9 and the page does not
display anymore page BUT there now 9 items displayed...?!
How can the page size affect affect the result of a
filter ?!

I actually ran this in 'debug mode' with a break point in
my code and witnessed the number of items (Items.Count)
change before my eyes in the watch window as I changed
the page size value.

Here is a sample of code :

(...)
With oDV
.Sort = strSortField & strSortOrder
.RowFilter = mstrFilter
End With

With dgItems
.PageSize = 8
.PagerStyle.Mode = PagerMode.NumericPages
.DataSource = oDV ' A DataView object
.DataBind()
End With
(...)

Any ideas ?

Thank you,

Ben
 
It should not, but without understanding your data, and the filter you are
applying, I can only guess that you might have found a bug. I do know that a
result set that is not refreshed can end up with this type of behavior when
you reduce the number of items to one page less than before the edit. And,
there are tutorials for compensating for this. The extra item for a filtered
list is a bit strange, to me.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Thank you Gregory.

Following a bit more experimentation, I have no choice
but to go for the bug theory... Nothing else makes much
sense...

Thanks for your input...

Ben
 
Back
Top