Accessing BusinessBindingSource Data


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I am using a Devexpress grid with a BusinessBindingSource as the Source of the data linked to a SF BO. Most of the time this works fine. However, when I delete a Row, and I want to view an 'Unbound' field, I am getting errors. In Devexpress terms, an Unbound Field is where the Value is not directly in the table, but a Piece of Code is run to return the field. This code is put into a 'CustomUnboundColumndata' event .

When I run similar code, using a Bog Standard Windows BindingSource as the Data Source, data is returned fine, so I am assuming I am not taking care of some differences betwee the Windows BindingSource and the SF BuisnessBindingSource.

The code below runs fine using a Windows Binding Source , but when using te SF BusinessBidingSource, Null gets into the rowView, and so an error is thrown

private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)

        {

           GridView view = sender as GridView;

           if (e.Column.FieldName == "Unbound" && e.IsGetData)

           {

               IList source = view.DataSource as IList;

               DataRowView rowView =source[e.ListSourceRowIndex] as DataRowView;

               e.Value = rowView["FirstName"]+ "Test";

           }

        }

 

Anybody doing something similar with Devex (i.e. running CustomeUnboundColumnData event), or know how to amend the above in a SF BusinessBindingSource scenario


Edhy Rijo
E
StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)StrataFrame VIP (4.5K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Gerard,
I use DevExpress grids but I have not tried using an Unbound column, instead I create a Custom Field Property in the BO which will be shown as a column in the grid via the SF BindingSource.
Also I noticed that the DevEx grids don't like having SF BO properties with null values, so I had to return and Alternate value on Null via the BOM for each field.
Hope this help you in this case.

Edhy Rijo

Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)Advanced StrataFrame User (628 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Hi Edhy. Thnaks for replying.

Initially  I had tried using Custom Field Properties but found for my purpose that Unbound Columns worked better, e.g. If I add a Row to the Grid, it automatically runs the unbound code populating the Lookup field without having to insert additional code. I also had some issues with the Custome Fields (Cant remember exactly what thy were now)  but decided on the Unbound Field as a more flexible alternative to polulate 'unbound' columns.

Also, I tend to avoid Null fields also

I think my problem here is that the Windows Binding Source is returning an Ilist which has the colums/row whereas perhaps the SF BusinessBindingSource returns someting different
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