|
-
Sep 18th, 2003, 09:51 AM
#1
Thread Starter
Member
Using a SortedList as a datasource to a Datagrid
Anyone know how I can use a SortedList of objects and display this contents of the SortList objects in a DataGrid.
one row for each object in the list;
i.e. my object
public class MyObject
{
public MyObject()
{
//Constructor
}
public string name;
public string address;
}
add 100 objects of my class above to MySortedList. each with a different name and address.
How would I bind MySortedList to the Datagrid
-
Sep 18th, 2003, 11:13 AM
#2
PowerPoster
I am not one hundred percent sure, but I think you need to set the datasource equal to your list, and set the datamember equal to the actual property of your class you want to bind to. You might have to also implement an interface to allow you to bind to the objects as a datasource...not sure.
-
Sep 18th, 2003, 11:59 AM
#3
Thread Starter
Member
Got it sorted now.
I Set the datasource to my sorted list, and then in my class I added some public get/set properties to allow data access.
The databinding process picks up the fact that you have these public properties visible in your class and uses them as the grid columns.
Now to set the header text !! which is not proving easy.
Where's good ol' Flexgrid when you need it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|