User (Old forums)MemberApril 17, 2009 at 11:48 pmPost count: 23064
I have got a database with a Sales Item table and a Product listing lookup table. The basic table structure as follows:
Sales Item (SalesID, ProductID, Quantity, Unit Price, Subtotal)
Product Listing (ProductID, ProductName)
Now, I have setup a databound grid with underlying data taken directly from the Sales Item table. On the grid displaying to the end user, it should display the following :
SalesID, ProductID, Product Name, Quantity, Unit Price, Subtotal
As one may easily observe, There is an unbounded column displaying Product Name on the GUI, but it doesn’t store it for each item sold within the Sales Item table.
So, what I have done is to populate the product name and displaying it in an unbounded column during the OnPaint event. However, this will get into the process of retrieving each product detail of each row continuously. I felt this is not very efficient and may create system lagging when the data table and product lookup table becomes too large.
What is the better way to go about achieving the above? Please do assist.
Thank you very much.
Imported from legacy forums. Posted by James (had 1930 views)User (Old forums)MemberApril 20, 2009 at 11:26 amPost count: 23064
If you supply the ProductName only when adding rows, you can use the AddingDataRow event on the GridControl, and get the ProductName from the Product table in the event handler for the specific ProductID, so that this is done only once.
If the data can be edited by the user so that the ProductID can be change on a specific row, you can also subscribe to the ValueChanged event of the ProductID cell, and update the ProductName only when the ProductID is changed. You can subscribe to the event through the DataRowTemplate (e.g. DataRowTemplate.Cells[ “ProductID ” ] .ValueChanged).
Imported from legacy forums. Posted by André (had 1477 views)User (Old forums)MemberMay 26, 2009 at 7:50 amPost count: 23064
Thank you for your recommendation, I’ll give it a try tomorrow and see if its better. I just think repaint the grid multiple times just for this will create alot of overhead on the server.
thank you once again.
Imported from legacy forums. Posted by James (had 1889 views)
- You must be logged in to reply to this topic.