I have a number of datagrids bound to collections. When the collections are
populated i get the column headings as per the ColumnStyles for the grid.
However if the collection is empty no column headings are visible.
Is there a way to force the headings to display other than having a dummy
item in the collection?
guy
Yes, implement a strongly typed indexer for the collection. Ofcourse
this won't work with built-in collections but only with custom collections.
For e.g. if your collection is of class Employee then you need to write
an indexer like this
public class EmployeeCollection : CollectionBase
{
public Employee this[int index]
{
get{ return List[index]; }
}
}
that's it..
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
> I have a number of datagrids bound to collections. When the collections are
> populated i get the column headings as per the ColumnStyles for the grid.
[quoted text clipped - 4 lines]
>
> guy
guy - 30 Sep 2004 10:40 GMT
many thanks:-)
guy
> Yes, implement a strongly typed indexer for the collection. Ofcourse
> this won't work with built-in collections but only with custom collections.
[quoted text clipped - 24 lines]
> >
> > guy