Filling DataGrid from collection class

Hello again,

is it possible to fill a datagrid based on a collection class?

my collection class is inheriting from the DictionaryBase class.

thanks

LVL 7
brdrokAsked:
Who is Participating?
 
dunglaCommented:
brdrok,

MSDN said: "The data source must be an object that implements the System.Collections.IEnumerable interface"

you can fill a datagrid based on a collection class which inheriting from the DictionaryBase class. Because DictionaryBase is the class implement IEnumerable interface.
0
 
brdrokAuthor Commented:
Hey dungla....

thanks for your feedback.  I can't seem to find "The data source must be an object that implements the System.Collections.IEnumerable interface".  Can you please provide a link.  

The closest thing i saw was: "The following data sources are valid: Any component that implements the IList interface"

However, from what I have gathered so far is that the "DictionaryBase" is implementing the following interfaces: ICollection, IEnumerable, and IDictionary. Does that mean, I am out of luck?  Does that mean I will have to declare my class like this:

public class Employees : DictionaryBase, IList

So many questions, and only so many hours in a day :)


0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
NipNFriar_TuckCommented:
Hi brdrok, the answer to your question is yes.  The DictionaryBase inherits from ICollection, which is a parent of IList.  So you would need to include IList on your class definition and implement the needed functions for IList.
0
 
brdrokAuthor Commented:
NipNFriar...

thank you.  I have posted another question (400 pts) asking how to implement the Add method of the IList interface.  Can't seem to get it to work.  If you would like to take a crack at it, it should be there.  thanks

 
0
 
dunglaCommented:
brdrock

Here is the link in my MSDN July 2004

ms-help://MS.MSDNQTR.2004JUL.1033/cpref/html/frlrfSystemWebUIWebControlsBaseDataListClassDataSourceTopic.htm

The topic: BaseDataList.DataSource Property  [C#]
0
 
brdrokAuthor Commented:
thanks for the help.  i suppose creating a dataview is the way to go about this.  still was somehow hoping to implement the IList interface to my DictionaryBase collection class but appearantly I am still too dumb :(

Was trying to ge the best of both worlds.  implement the IList so i can use it as a datasource for a datagrid, but I also like the key, value pair as well....  

anywho......thanks for all your help you two....


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.