Using custom properties to bind report fields


Author
Message
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
I am using DevExpress XtraReports and have been able to make it work using a BusinessBindingSource as a DataSource, and then linking that BBS to a BO which has my report data in it.  I have done this many times already and have had no problems thus far.  I have been working on a problem for the past few days and haven't been able to figure out a solution.

I have several custom field properties on my BO which I have bound to fields in my report.  There are also several "regular" BO properties which link directly to fields in the db table.  The custom fields are all showing as blank, but the regular properties are showing as the correct values.  I don't think it is even getting to the code for the custom properties since I have set break points in them which are not getting hit.  I even tried hardcoding one of them to return a string value which also didnt show up. 

Its almost like it doesnt know how to find the custom properties.  I thought it was a problem with the binding, but if it can find the non-custom properties then it is binding correctly (I think).  Here is an example of one of the custom properties:

<Browsable(False), _
BusinessFieldDisplayInEditor(), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property TransferAmt() As Decimal
  Get
    Return FixAmt(Me.CurrentRow.Item("TransferAmt"))
  End Get
End Property

And I am also adding the custom property descriptors as I am supposed to, like the following:

Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _
 
New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("FacilityDescr", GetType(DailyTransactions)), _
  New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("DisburseAmt", GetType(DailyTransactions)), _
  New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("PaymentAmt", GetType(DailyTransactions)), _
  New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("StmtAmt", GetType(DailyTransactions)), _
  New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("FeePostAmt", GetType(DailyTransactions)), _
  New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("TransferAmt", GetType(DailyTransactions))}

End Function

Any advice, ideas, suggestions, etc?  Thanks!  I'm really stuck on this one.

Replies
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
You are right on the money.  Yes, I am inheriting from another business object, and yes when I overrode that property it fixed it.  So now....how about that permanent solution you were talking about??  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: 6.9K
Just create a private and manage this manually for this BO.  If will look like this:


Private Shared _AreCustomDescriptorsEvaluated As Boolean = False

''' <summary>
''' Determine if the custom descriptors are going to be evaluated
''' </summary>
''' <remarks></remarks>
Protected Overrides ReadOnly Property AreCustomDescriptorsEvaluated() As Boolean
    Get
        '-- Establish Locals
        Dim r As Boolean = _AreCustomDescriptorsEvaluated

        '-- Do not eval the desciptors again
        _AreCustomDescriptorsEvaluated = True

        '-- Return results
        Return r
    End Get
End Property

Notice that the private is shared...this is an important step.  Add this and you will be good to go. Smile

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