We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataBoundGrid bound to ArrayList

Hi,

I have a GridDataBoundGrid bound to an ARrayList.
I want to add a button which on clicking should enable the user to add new values from to Grid into the ArrayList.

This I think can be done by IBindingList support, I am looking for a sample code. I am missing something .. but I dont know where and what.

Any psuedo code or a sample code which binds and allows user to add new rows to the ArrayList would be really helpful.

Tnx.

4 Replies

HA haneefm Syncfusion Team July 13, 2007 05:44 PM UTC

Hi Grace,

Below is a minimal sample that shows this task.Please try this and let me know if this helps.
GDBGArrayList.zip

Best regards,
Haneef


GR Grace July 22, 2007 07:25 PM UTC

Have a question here:

First off: If the User edits any values in the grid, Will they be saved to the Arraylist automatically? Or Is coding required to grab these changes and put them into the underlying datasource: which is the ArrayList

2. The application I am maintaining, does not show me the extra blank row that is added at the end of the grid. Why is that? Is there a property that suppresses the creation of the blank row at the end.

>Hi Grace,

Below is a minimal sample that shows this task.Please try this and let me know if this helps.
GDBGArrayList.zip

Best regards,
Haneef


HA haneefm Syncfusion Team July 23, 2007 05:41 PM UTC

Hi Grace,

1.If the User edits any values in the grid, Will they be saved to the Arraylist automatically? Or Is coding required to grab these changes and put them into the underlying datasource: which is the ArrayList
>>>>>>>>>>>>>>>>>>>>>>>>>>>
In General,The databound grid will push all data for a row into the underlying datasource(datatable,ArrayList,etc...) for every record once you move the current cell of that record. Once the changes for a record have been pushed into the datasource the grid has no more knowledge about these changes and thus cannot reverse and undo these changes.It does not push all data for a row into the underlying datasource for every cell movement.If you want to push all data to undelying datasource for every cell movement,you need to call in Binder.EndEdit Method(before calling this , you need to call the CurrentCell''s Edit method).

2. The application I am maintaining, does not show me the extra blank row that is added at the end of the grid. Why is that? Is there a property that suppresses the creation of the blank row at the end.
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Extra blank row is called as AddNewRow. You can control the add new row by setting the EnableAddNew property. The grid only supports adding new records if the underlying datasource allows it.(ArrayList doesn't support AddNewRecord). Starting an edit on the addnew row will automatically create the next addnew row. This is MS-Access type behavior, always showing an empty addnew row.

Best regards,
Haneef


GN grace nethala July 23, 2007 09:31 PM UTC

Thanks a lot Haneef! Answered my questions.

>Hi Grace,

1.If the User edits any values in the grid, Will they be saved to the Arraylist automatically? Or Is coding required to grab these changes and put them into the underlying datasource: which is the ArrayList
>>>>>>>>>>>>>>>>>>>>>>>>>>>
In General,The databound grid will push all data for a row into the underlying datasource(datatable,ArrayList,etc...) for every record once you move the current cell of that record. Once the changes for a record have been pushed into the datasource the grid has no more knowledge about these changes and thus cannot reverse and undo these changes.It does not push all data for a row into the underlying datasource for every cell movement.If you want to push all data to undelying datasource for every cell movement,you need to call in Binder.EndEdit Method(before calling this , you need to call the CurrentCell's Edit method).

2. The application I am maintaining, does not show me the extra blank row that is added at the end of the grid. Why is that? Is there a property that suppresses the creation of the blank row at the end.
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Extra blank row is called as AddNewRow. You can control the add new row by setting the EnableAddNew property. The grid only supports adding new records if the underlying datasource allows it.(ArrayList doesn't support AddNewRecord). Starting an edit on the addnew row will automatically create the next addnew row. This is MS-Access type behavior, always showing an empty addnew row.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon