GetEnumerator custom collection doesn't work with datagrid

kaoskoder

New member
Joined
Jan 26, 2004
Messages
1
Hi,

Ive created a custom collection implementing IList (which implements ICollection and IEnumerable).
In this collection i want to use a custom enumerator. I would want to use this to filter the collection on the databind to the control.
Weird thing is that for all of the controls that have datasource property and databind method, the code gets into the GetEnumerator method (web and windows forms controls).
But only for the datagrid (both in windows forms and web), it doesnt go into the getenumerator of the datasource.

Now, if i implement ICollection instead of IList then the GetEnumerator gets invoked but only for the webdatagrid (cause the windows forms datagrid needs the IList interface).

In this code example on msdn where they override the DataBind, they use the getenumerator of the datasource :

http://msdn.microsoft.com/library/d...systemwebuicontrolclassondatabindingtopic.asp

Almost the only thing i found was this discussion

http://groups.google.be/groups?hl=n...lvNBM7dDHA.2560%40TK2MSFTNGP10.phx.gbl&rnum=1

but that didnt gave me answers either. :-\

Can anyone give me an explanation for this behaviour (/bug)?
Ive attached a file with a custom collection and a windows forms which fills up a datagrid and a listbox with the same collection.
 

Attachments

Last edited by a moderator:
Back
Top