StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12»»

Binding to an editable grid?Expand / Collapse
Author
Message
Posted 07/19/2006 9:31:39 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/25/2008 10:33:22 AM
Posts: 318, Visits: 460
Is there any way to bind to the enhanced list and also have it be editable so that users can make changes directly to the grid itself?  If not with the enhanced list is there a way to do it with the DevExpress grid control?
Post #1889
Posted 07/19/2006 9:34:26 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
The Enhanced list is a grid modified for list-like interaction.  This is to produce a behavior more like the ListView within the standard StrataFrame control collections.  If you want to allow editing within a grid, then you will need to use the DevExpress grid.  When using a grid you will need to use the CurrentDataTable or CurrentView of the business object as the data source. 
Post #1890
Posted 07/19/2006 9:38:31 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/25/2008 10:33:22 AM
Posts: 318, Visits: 460
Ok, is there a way to have it accept changes made by the user in the grid and save them to the bound data source?  Or is this just something that I'll have to do manually somehow?
Post #1891
Posted 07/19/2006 9:41:54 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
You will have to save the changes back to the database yourself.  You will need to call the Save on the BO before the changes are committed to the database.  Is this what you mean?  The same is true for any other StrataFrame control, it requires a Save before any change is committed.
Post #1892
Posted 07/19/2006 10:05:09 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/25/2008 10:33:22 AM
Posts: 318, Visits: 460
That's kind of what I'm asking. I guess what I mean is does it work like the other SF controls which you can just set to a BO and they automatically update as you change the contents using the Edit and Save events.  Will it work along with something like the Maintenance Toolstrip?
Post #1893
Posted 07/19/2006 10:11:46 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
StrataFrame uses an ADO.NET data table internally in a BO to store the data.  If the internal data table (CurrentDataTable, CurrentView, or CurrentRow) changes any of the contents either manually or through a control of some sort, the BO will know that it is dirty and requires an update.

For example, the code below changes the field through the weak typed ADO.NET data table instead of using the strong-typed properties of the BO.

MyBO.CurrentDataTable.Rows(0).Item("my_field") = "Testing"

This will change the contents of the field and the business object will still know that a save is required just as though it had been changed through a strong-typed property or an SF control.

If MyBO.IsDirty Then
     MyBO.Save()
End If

So if you use ADO.NET data binding to the DevExpress grid, the BO will still function properly.  But you will still be required to manually call the Save() method on the BO to save commit the changes back to the server.

Post #1894
Posted 07/19/2006 10:23:58 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/25/2008 10:33:22 AM
Posts: 318, Visits: 460
Great!  Thanks, I think I have something working now.  This will be great for what I'm trying to do.
Post #1895
Posted 07/19/2006 12:10:59 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 11/25/2008 10:33:22 AM
Posts: 318, Visits: 460
Everything seems to be working fine, except for when I add a new row to a blank table.  It gives me an error on my BO.Save method saying 'An error occured while saving data to the server' and to check the InnerException.  Well basically it looks like CurrentRowIndex is set to -1 even though there is a record in the BO.  The actual error message is this:

{"The CurrentRow could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 1.  CurrentRowIndex: -1."}

Any idea what would cause this?  I can add records to a table that already has records, but not to a blank table. 

Post #1896
Posted 07/21/2006 9:20:49 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
Andria,

Sorry for the slow response.  I guess I missed this post.  At what point are you getting the error message?  Can you give me a code snippet?

Post #1911