Populating and Entity in a collection with Values from another Enity

Posts   
 
    
kioko
User
Posts: 29
Joined: 12-Dec-2009
# Posted on: 09-Jan-2010 12:23:07   

Hi Guys,

This is my first post and I am new to llblgen so please forgive me if i am asking a question that has already been asked i have searched past threads for a solution with little success.

I would like to implement a look up action as described below.

Taking the northwind self servicing example application. How would you ensure that when a user adds a new order details item that the grid would automatically update the product price with that product price for the entered product from the product table. For example if a user created a new order and entered productid 1 (for Chai) The unit price field would automatically reflect the price of chai which is 18.00

Regards

Kioko

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Jan-2010 21:17:54   

I think this is done because the product information is retrieved when you fill the combobox so you already have the unit price information, it's just to update the grid in the postback or using ajax.

What is the example application you are referring btw?

David Elizondo | LLBLGen Support Team
kioko
User
Posts: 29
Joined: 12-Dec-2009
# Posted on: 11-Jan-2010 18:11:43   

Hi David,

Thanks for the reponse. The example i am referring to is the Northwind example 1 (VB.NET version) which is a winform application. I am trying to make the Grid "smart" and i am looking for the best place to place the code to refresh the grid and populate the unit price filed in the grid from the Product Entity.

Kioko

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Jan-2010 06:49:28   

Hi Kioko,

In the example you are referring, the UnitPrice is taken from the OrderDetail entity, not directly from the Product entity. If you want to take the UnitPrice from Product entity you can have a product collection and fetch it when you load the form. Then you can query it (in-memory) to find the unit price of the selected product. You can do this in some grid event (like Cell changed). It's better if you use a DataGridView instead of a DataGrid, this way you can bind the products list to a comboBox and use it in the grid (look at the Validation and Auditing examples for SelfServicing).

David Elizondo | LLBLGen Support Team