Can you hide the first band in a wingrid? Or can I promote a child band to the parent band? I am trying to create drill-down type functionality, and I am trying to reuse the same grid. If I could just Hide the parent band, it would suffice, but upon hiding, all child bands disappear. Even if I hide the grid row.
twinfrey said:What is the datamember name if I am not using a dataset with tables and relationships? I am actually binding to a bindinglist of an interface. The interface has a collection, which binds to the second band. It is the second band that I want to be the "Order Detail".
To extend my previous example, say you have an Order class and an OrderDetail class. The Order class includes a BindingList<OrderDetail> property called OrderDetails, and you set the DataSource of your grid to a BindingList<Order> object (leaving DataMember blank). To show a particular OrderDetail in this scenario, you'd set the DataMember of your grid to "OrderDetails".
This sounds like what I need, and I am going to give it a try. What is the datamember name if I am not using a dataset with tables and relationships? I am actually binding to a bindinglist of an interface. The interface has a collection, which binds to the second band. It is the second band that I want to be the "Order Detail".
As far as hiding the band, I got really close by looping the columns of the first band, setting each one to hidden. I was able to turn off connectors, indention, spacing, and all of the other things normally seen. The only problem is that it left a white space where the first band would have painted, which I tried many, many things and could not prevent.
Hiding a row will also hide its child rows. Hiding a band will also hide all the rows in that band. Because of this, you cannot hide the parent band without effectively hiding all rows in the grid.
What it sounds like you want to do is re-bind your grid to the path that represents the set of child rows you want to show. While I don't have code I can test, I'll explain how to do this in principle.
Consider the Northwind database, in particular the Orders table and the Order Details table. Bring these into a .NET DataSet, with a relation called "Orders_OrderDetails" to connect them by their OrderID. Set your grid's DataSource to this DataSet, and its DataMember to "Orders", which provides you with a hierarchical view of orders and order details.
Now assume that you want to re-bind your grid to show only the order details for a particular order. This requires two things. First, ensure that the order whose details you want to show is the "current" item in the .NET BindingManager; you can do this in WinGrid by either activating that row or any of its children. Next, set the DataMember of your grid to "Orders.Orders_OrderDetails" - the name of the parent table followed by the relation name. Your grid should now show only those order details corresponding to that individual order.
This approach is usually used when you're showing two grids on the same form, one for orders and one for order details. Clicking rows in the "orders" grid (which changes the "current' item in the BindingManager) changes the data displayed in the "order details" grid, without needing to further change that grid's DataMember.
I hope this helps you get the result you're after.