I've been playing around with gridview.CollapseAllGroups, gridview.ExpandMasterRow, gridview.ExpandGroupRow and gridviewExpandAllGroups but simply can't find the right mix to do what I want.
I Have a grid control with master/detail releationship. The master view is grouped by default on a single field and the group header hiddin so the user can't change the grouping. (see attached screenshot).
What I want to have happen is the last group (Year :3 in the example) to be fully expanded a show in the ss by default. I'd like to then have it so when the user clicks on the Year: 1 or Year 2 rows all rows collapse and that year is fully expanded.
I've tired the following code in the master gridview mouse down event but it's not quite right. IE not all levels are expaned as seen the attached SS.
{
var hitInfo = gvPolicyTrans.CalcHitInfo(e.Location);
if (hitInfo.InRow && hitInfo.RowHandle < 0)
{
gvPolicyTrans.CollapseAllGroups();
gvPolicyTrans.ExpandMasterRow(hitInfo.RowHandle);
gvPolicyTrans.ExpandGroupRow(hitInfo.RowHandle, true);
gvTrans_Detail.ExpandAllGroups();
}
}
gvPolicyTrans is the master gridview and gvTrans_Detail is the child gird view.
Any help would be appreciated.
Thanks