Customized properties in Devexpress Grid Binding
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Customized properties in Devexpress Grid...Expand / Collapse
Author
Message
Posted 02/20/2008 6:14:08 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
I've changed some property names to friendly names using custom code option in Business Object Mapper.

(Plus override GetCustomBindablePropertyDescriptors for these fields)

I've noticed that when this object was bind to a Devexpress Grid with business binding source, these properties were not seen in Devexpress Grid.

I've tested for Devexpress (Wrapped) Textbox. These fields were listed in the BindingField list of the textbox.

What is missing ?

Post #14453
Posted 02/20/2008 9:04:39 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 9:47:36 PM
Posts: 4,115, Visits: 4,185
Do you have the same behavior with a DataGridView?  The reason I ask is so that you can determine the source of the issue.  If you have the same behavior in a DataGridView then you are probably missing something else in your BO.  But the IBindingList interface (which is used on on the BBS) uses the type descriptors to determine which fields will be avaialble, so if you have them defined in the GetCustomerBindablePropertyDescriptors then this may be an issue someplace else.
Post #14455
Posted 02/20/2008 9:24:04 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
I have base Business Object say (CustomersBase) and

Complex Business Object Say (Customers) which is inherited from CustomerBase.

I'm using Customers (Object) for binding. But  I've written override GetCustomBindablePropertyDescriptors on CustomerBase. I'll explore this situation.

There is need to get that code one level up to Customers object or This code will be required with two objects.

Post #14459
Posted 02/21/2008 1:32:03 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
I've repeated the task and everthing has worked. I assume that I may had something like typing wrong property names. There is no need to write override method for two objects (See my previous post).
Post #14473
Posted 02/21/2008 3:35:33 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
After I've seen my customized property in my Devexpress Grid, I've changed all the properties with friendly names.

But I've not seen these properties in Devexpress Grid. (None of them) And Retrive fields button was disabled (There is nothing to retrive for the Devexpress Grid)

I could'nt understand what was happening.

For Testing, I've changed back one property back to its default. (No customization). Then, I've got only this property in Devexpress Grid. And I've also tried what was happening with DataGridView, The Result was the same. Only One property in the DataGridView.

My Custom Code for a field : (Use Custom Code option)

[Browsable(false),

BusinessFieldDisplayInEditor(),

Description("Group Id"),

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public Nullable<System.Int32> pGroupId

{

get

{

object loValue;

loValue = this.CurrentRow["group_id"];

if (loValue == DBNull.Value)

{

return (Nullable<System.Int32>null;

}

else

{

return new Nullable<System.Int32>((System.Int32)loValue);

}

}

set

{

if (value.HasValue)

{

this.CurrentRow["group_id"] = value.Value;

}

else

{

this.CurrentRow["group_id"] = DBNull.Value;

}

}

}

My Method

protected override FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()

{

return new FieldPropertyDescriptor[] {

new ReflectionPropertyDescriptor("pId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pGroupId", typeof(CompaniesBase)),

// new ReflectionPropertyDescriptor("pCode", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pName", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCityId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTownId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCountryId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pZipCode", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhone1", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhone2", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pFax", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pRelatedPerson", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pEmailAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pWebSiteAdress", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTaxNumber", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pTaxOffice", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pPhoto", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pType", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pIsActive", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pRecordStamp", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pInsertedByUser", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pClientAccountId", typeof(CompaniesBase)),

new ReflectionPropertyDescriptor("pCreditAmount", typeof(CompaniesBase))

};

}

Post #14475
Posted 02/21/2008 9:07:15 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 9:47:36 PM
Posts: 4,115, Visits: 4,185
What does the declaration of your BO class look like?  In the GetCustomBindablePropertyDescriptors method, you are using the type of CompaniesBase, is this the class that your custom properties are defined within?  There is really not much that has to be done....if you have type descriptors create or have them defined in the GetCustomBindablePropertyDescriptors method, they should show up.  What does your BO Mapper settings for one of your custom properties look like?  Do you have any other options checked, like the Create Descriptor?  If so, then this is probably your issue.  You do not need that checked since you are defining the GetCustomBindablePropertyDescriptors.
Post #14480
Posted 02/22/2008 12:47:39 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
I've checked "Use Custom Code" and No other option is selected in Business Object Mapper. Simply, I want to change the property names to more friendly names. For a field, I've got the generated code for a property, Pasted into Field's custom code section, Changed the property name. And Within my class (CustomersBase) overriden the method (GetDescriptors) with this property.

This was what I've followed. Is this a correct procedure ?

There is a conflict in my mind with custom properties. For above explanation, What I am doing is to change property name for a field. I'm customizing only the apperance of the property name. This is not a custom field according to my opinion. This is a customized field. When I reference to your documentation and forum posts, I see the Custom fields are the new fields that does not exist in the object. So they are defined in the object.

In my case, My customized property  are generated by the tool (uses the changed property code) with new name.

Is it near to give a friendly name in Business Object Mapper and to follow our business ?

Post #14515
Posted 02/22/2008 12:58:46 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Today @ 12:54:47 AM
Posts: 115, Visits: 345
I've checked "Use Custom Code" and No other option is selected in Business Object Mapper. Simply, I want to change the property names to more friendly names. For a field, I've got the generated code for a property, Pasted into Field's custom code section, Changed the property name. And Within my class (CustomersBase) overriden the method (GetDescriptors) with this property.

This was what I've followed. Is this a correct procedure ?

There is a conflict in my mind with custom properties. For above explanation, What I am doing is to change property name for a field. I'm customizing only the apperance of the property name. This is not a custom fi