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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Business Entity Collection and GDBG

Thread ID:





33854 Aug 27,2005 07:42 PM UTC Aug 28,2005 09:31 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On August 27, 2005 07:42 PM UTC

Hi, I need to decide whether should I use traditional DataTable or I can use the collection of my business object. I have the following question. Q1 Can I use the Collection of business entity as “dataSource” for my GDBG? Is there a sample application that using object collection as data source for GDBG? Assuming that we can do that: Q2 How does it work when we change a value in cell, does it get changed in object automatically or we have to write code for this? Q3 What are the griddatacolumn when we are using collection of objects as data source? Q4 Can I use “LayoutColumns” in order to show my record in multiple row? If there is any sample that would be great. Q5 Can I use still “formulas” in my GDBG grid? Does grid update data in object when we change the value of a cell which has formula assign to it? Please do reply! Thanks, Scott

Administrator [Syncfusion]
Replied On August 27, 2005 08:57 PM UTC

1) Yes. Any IList of objects with public properties can be used. Here is a sample using ArrayLists. http://www.syncfusion.com/Support/user/uploads/GDBG_8c7a9cee.zip 2) The default behavior is when you change a value in a cell, the object gets updated when you leave that modified row in the grid. 3) The default behavior is to use the prublic properties of the object in the list. 4) Yes. The sample above does this. 5) You need to do additional work to use excel-like formulas in a GridDataBoundGrid. See this KB. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=104

Administrator [Syncfusion]
Replied On August 27, 2005 09:58 PM UTC

Thanks, When i say Formulas in GDBG, i mean while i am using a collection of business entity as my " datasource ", can i also use formula at the same time? is there any article where it explain how does GDBG work with other datasource, I mean with collection of business entity. Please do reply!

Administrator [Syncfusion]
Replied On August 27, 2005 10:09 PM UTC

I do not understand what you mean. If you want to add a column in the grid that is a calculation based on the properties in the same row, then you can use a GridGroupingControl. It will allow you to add expressions fields in the same manner you can add DataColumn.Expressions to a column in a DataTable, but it does not require a DataTable. In a GridDataBoundGrid, if your DataSource is not a DataTable, then you will have to do work to support formulas, whether they are excel-like as disused in the kb, or if they are DataColumn.Expressions-type formulas. To support a DataColumn.Expressions type formula, you can add an unbound column, and perform your calculation to populate the unbound column. This sample shows how you can add an unbound column. \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\DataBound\GDBGMultiHeader

Replied On August 27, 2005 10:13 PM UTC

But when using an IList as a Datasource in stead of a DataTable, there are some grid functionslity that does not work: 1. You can not sort the grid (column sort). 2. You can not add and delete rows. To get this functionality your collections must implement some interfaces (at least IBindingList i think) I eneded up transforming my Business Entities to DataRow objects, and my collections to DataTables on the client by using reflection. And then bind them to the grid. And I transform them back to entities before saving them, using flags to indicate new/update/delete on rows. Rune

Administrator [Syncfusion]
Replied On August 28, 2005 07:28 PM UTC

Rune, what exactly you mean by "adding" and "delete" doesn''t work. which syntax i can''t use? would it be possible for you to provede a simple sample, how did you do it ? thanks,

Replied On August 28, 2005 09:31 PM UTC

Hi Scott, If you use a DataTable as datasource, you can mark a row and press the "Delete" key to delete the row. And you can add a new row, usually by entering data in a blank row at the bottom. Add, delete and updates will be flagged in the rows in the DataTable without writing any extra code. Add and delete is not supported if the datasource is an ArrayList. You can see one way to implement add/delete in this sample: http://www.syncfusion.com/faq/winforms/search/818.asp This sample uses the standard .NET DataGrid, and buttons for add and delete. Another way is to implement IBindingList in your collection. My solution is, as i said, to transform Entity to DataRow and back (a collection becomes a DataTable). I don''t have a sample now, but send me an e-mail at runesel@homail.com, and i''ll send you a sample tomorrow. Regards Rune >Rune, > >what exactly you mean by "adding" and "delete" doesn''t work. > >which syntax i can''t use? > >would it be possible for you to provede a simple sample, how did you do it ? > > >thanks,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon