• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

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

0
brdrok
Asked:
brdrok
  • 3
  • 3
2 Solutions
 
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now