Problem with Custom Field Property


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You're welcome, Thomas.

Glad you got it working. Cool
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

I did what seemed to be the best, deleted everything and started new. Now, thanks to your example, everything is working as it should be.

Thanks again and best regards

Thomas
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi there.

The message you got was a bit strange... would you like to write a small sample and post it here for us to have a look?
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

thanks a lot for aour example. Unfortunately I can not get it to work. I remapped the BO to the customers-table in the strataframe-database, but get the error-message (translated from german) "Object name Customers not Valid".

But I could study the code to learn how a field is added to the table and how the example should work, so I tried to copy it to my BO. But this does not work; I get an error-message (again translated) "Conversion from Type DBNull to Type DBString is not valid". I do not understand where this comes from as there a no Null-Values in the table nor in the BO and it should be filled in cases where there an no values in the according fields with empty strings? Or is my thought wrong?

Thanks a lot and best regards

Thomas
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Thomas.

It looks like the Grid needs the datatable to have the column as of itself.

I created a sample that creates temporary fields on the table with the same name as the custom field, and was able to sort on it. See if it helps.
Attachments
CustomFieldGrid.zip (175 views, 191.00 KB)
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Trent,

this is what I wrote in the BO:



<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("Wahlweise Vorname oder Name2"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [GRIDNAME2]() As System.String

Get

If Me.ADRESSTYP = "P" Then

Return Me.VORNAME

Else

Return Me.NAME2

End If

End Get

End Property

 

#End Region

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

'Return MyBase.GetCustomBindablePropertyDescriptors()

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"GRIDNAME2", GetType(KundenBO))}

End Function



I can see no difference?

Thanks a lot and best regards

Thomas
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Did you overwrite the GetCustomBindablePropertyDescriptors method on the BO?  When you create a custom field to which you are going to bind, you have to make it known to reflection.  In order to do this, it will look like this:

VB.NET

''' <summary>
    ''' Provider property descriptors for the custom bindable fields
    ''' </summary>
    Protected Overrides Function GetCustomBindablePropertyDescriptors() As StrataFrame.Business.FieldPropertyDescriptor()
        '-- Return the array of property descriptors
        Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() _
        { _
            New ReflectionPropertyDescriptor("MyCustomFieldNameHere", GetType(MyBusinessObjectBO)) _
        }
    End Function


C#
/// <summary>
    /// Provider property descriptors for the custom bindable fields
    /// </summary>
    protected override StrataFrame.Business.FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()
    {
        //-- Return the array of property descriptors
        return new MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] { new ReflectionPropertyDescriptor("MyCustomFieldNameHere", typeof(MyBusinessObjectBO)) };
    }

Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

good to see the forum again.

In a BO I created a custom field property (Called "GridName2") according to the helpfile and I use this field via a Businessbindingsource in a DataGridView. So far so good. This property returns, depending on the type of adress (Private or Business) either the firstname or the department.

But when I click on the Column-Header of the DataGridView to sort this field, I get an error message (translated from german)

"Column Gridname2 was not found"

What could I have done wrong?

Thanks in advance

Thomas
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