I have two WinGrids on a Windows form. It is similar to Customers and Orders grids. When I select a row (activate) from the customers grid, I want to populate the Orders grid based on the Customer Id from the Customers grid. I am not sure how to find the currently active row on the customer grid. "AfterRowActivate" does not seem to contain any information about the row. I am sure this is simple enough to do. But don't know how. A pointer to some sample code is highly appreciated.
By the way, I am using NetAdvantage 2008.1.
Thank you
Babu.
You can get the active row by using the grid.ActiveRow property any time, but I think you should solve it not through the grid. Actually this is a simple master-detail issue and you can find many samples for that.
I do it like that:
1. Load Customers and Orders. You can use lazy load that loads Orders only by demand, like Linq to Sql does.
2. Create a BindingSource and set the Customers as its data source. Set the binding source as the Customers grid data source.
3. Create a BindingSource and set the Customers as its data source. Set the DataMember property as the name of the property in the customers that used to get its orders, like "CustomerOrders". Attach this Binding source as the data source of the orders grid.
That's it. When you select a customer it'll automatically show its orders. You can use the designer of VS for that. Open the Data menu and select "Show Data Sources" and add a new Data Source to your project. What you do from here depends how you bring your data.
Thanx jct. Am I to create two different binding sources or just one and bind the same to the two grids with corresponding Datamembers? I think I tried your suggestion in this manner but didn't seem to work. Would you be kind enough to include some sample code or just point me to a link that has the sample for a similar purpose?
Thanx again.