StrataFrame Forum

Editing data using DevExpress

http://forum.strataframe.net/Topic6785.aspx

By Chan - 2/14/2007

Hi,

I am using DevExpress Grid for data entry. I am using BindingBusinessSource for data binding.

My question, how could I have additional column that show product description, for example after select product code?

Thank you

By Trent L. Taylor - 2/15/2007

Include it in your SQL query or create a custom field.  I recommend the custom field which returns the description.  You can use a scalar method to pull the description from a FK table.  When you create a custom field, the BO treats it as though it belongs to that table.  You can see how to do this in the docs or the CRM sample for examples of how to achieve this.
By Chan - 2/16/2007

You can use a scalar method to pull the description from a FK table.




Hi,

Do you meant to use ADO.NET code directly to retrieve the FK desciption?



Thank you
By Trent L. Taylor - 2/16/2007

No.  You can create custom properties to a business object.  If you look at the tutorial documentation it shows you how to do this:

Application Framework -> Getting Started -> Creating a WinForms App -> Adding Custom Field Properties

You can then make this a Readonly property and then execute a scalar query to retrieve the data:

Public Readonly Property MyCustomProperty As String
    Get
        '-- Establish Locals
        Dim loCommand As New SqlCommand()
        loCommand.CommandText = "SELECT MyDescriptionField FROM MyTable WHERE MyFK=@MyFK")
        loCommand.Parameters.Add("@MyFK",SqlDataType.Int)
        loCommand.Parameters("@MyFK").Value = Me.MyFKField
        Return CType(Me.ExecuteScalar(loCommand), String)
    End Get
End Property