Binding to an editable grid?


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I am glad you got going.  Sorry again. Blush
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
That's okay, I've worked through it and have it working now.  Thanks though Smile
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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?

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
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. 

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Great!  Thanks, I think I have something working now.  This will be great for what I'm trying to do.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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.

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
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?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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.
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
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?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
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. 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search