Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1233
Hide first band
posted

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.

Parents
No Data
Reply
  • 45049
    posted

    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.

Children