BUG : Datagrid ?

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
**********************************************************************
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top