DataViews causing IndexOutOfRangeException

G

Guest

Here is what seems to be the problem. We have at DataTable Visit_List, and
we have two objects that need to bind to this data in different ways. So we
created two DataViews based on the DataTable. The DataViews are configured
as follows for each of the objects that bind to them:

List object:
RowFilter – only show visits for client A
Sort – VisitDate Descending, StartTime Decending

DataGrid:
RowFilter – only show visits for client A, and where col3, col4, col5
are not null
Sort – VisitDate
AllowNew – False
AllowEdit – False
AllowDelete – False

The problem we seem to be having is that these two DataViews seem to be
causing problems because they were created from the same DataTable.
Specifically the problem seems to lie with the Sort. If we change the
VisitDate in the List object for certain visits we will receive an
“IndexOutOfRangeExceptionâ€. If we give the same sort for both views we get a
bunch more of these exceptions, up til now we thought that the problem was
fixed if we simply did a sort of VisitDate on the DataGrid, but I recently
found if the Visitdate is put back a month or so we receive the exception
again. If we take the sort out of the DataGrid, things work fine. Is there a
way to get these two objects to play nicely together?

I have looked at the call stack and used reflector to see exactly what is
going on behind the scenes in .NET but it wasn’t much help. If you need any
additional info please let me know. Any suggestions would be appreciated.
 
I

Ilya Tumanov [MS]

Most common reason for that is using row index from the bound grid to access
DataTable or another DataView:



GRID - Row 0

|

DV1 - Row 0

|

DT - Row 0 can be any row here depending on DV1 sort and filter.

|

DV2 - Row 0 can be any row here depending on DV1 and DV2 sort and filter or
it might not present at all.

|

Other controls

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

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

Top