By Jeff Pagley - 12/1/2010
When I am binding the BO.CurrentDataTable to Strataframe.DevEx.ComboBox, the custom field is missing.
Here is the code I am using for binding. The custom field name is "DisplayDescription".
using (CostCodesBO loBO = new CostCodesBO())
{
loBO.FillAll();
cboCostCodes.ValueMember = "coco_PK";
cboCostCodes.DisplayMember = "DisplayDescription";
cboCostCodes.DataSource = loBO.CurrentDataTable;
}
Here is the BO Custom Field code:
protected override MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()
{
//--Create and return a new array of FieldPropertyDescriptor objects
return new MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] {
new MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor("DisplayDescription", typeof(CostCodesBO))};
}
/// <summary>
/// DisplayDescription
/// </summary>
/// <remarks></remarks>
[Browsable(false), BusinessFieldDisplayInEditor(), Description("DisplayDescription"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public System.String DisplayDescription
{
get
{
return String.Format("{0} {1}", this.coco_Number, this.coco_Description);
}
}
|
By Greg McGuffey - 12/1/2010
Did you build the app after adding the custom field? And you are using standard ADO.NET binding. Why are you using the SF PopulationDataSourceSettings that you'd set in the UI?
|
By Edhy Rijo - 12/1/2010
Hi Jeff,
Adding to Greg's question, shouldn't you be using a SF BusinessBindingSource to bind your grid instead of the BO's data table?
|
By Jeff Pagley - 12/1/2010
Greg,
Sorry guys, I had a lapse in memory. The SF PopulationDataSourceSettings is exactly what I wanted to use.
Thanks,
Jeff
|
By Greg McGuffey - 12/1/2010
Glad that fixed it!
|
|