PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How To Bind Objects To a DataGird ?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
How To Bind Objects To a DataGird ?
![]() |
How To Bind Objects To a DataGird ? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello.
How can I bind a list of objects to a DataGird? I have a custom collection of Customer class class Customer { Public String Name; Public String Addres; …. } How do I bind the collection to a data grid and the data grid will provide the options to add\modify\delete customers from the collection. If I put the Customers in an ArrayList data grid only display the data and I’m unable to edit it. Any help will be appreciated. Yaniv abo yanivabo@gmail.com |
|
|
|
#2 |
|
Guest
Posts: n/a
|
The ArrayList does not provide the interface you need in order to edit back.
The easiest way is just to populate a DataTable with one row per customer and then bind the DataTable to your DataGrid instance. Then you can edit/remove/add entries. When finished you can easily scan over the list of rows in the data table and find the ones that are new (create a new matching customer record), edited (update your existing customer record) or marked for deletion (remove it from your customers collection). Hope that helps Phil Wright Follow my microISV startup at.... http://componentfactory.blogspot.com "yaniv abo" <yanivabo@netvision.net.il> wrote in message news:exnWcOFaFHA.1152@tk2msftngp13.phx.gbl... > Hello. > > > > How can I bind a list of objects to a DataGird? > > I have a custom collection of Customer class > > > > class Customer { > > Public String Name; > > Public String Addres; > > .. > > } > > > > How do I bind the collection to a data grid and the data grid will provide > the options to add\modify\delete customers from the collection. > > > > If I put the Customers in an ArrayList data grid only display the data and > I'm unable to edit it. > > > > > > Any help will be appreciated. > > > > > > Yaniv abo > > yanivabo@gmail.com > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

