Hi I need to bind my datasource to ultragrid.
Assume my datatable got 4 colums col1, col2 col3 and col4(Title).
Need a code sample to show my ultragrid as below when it loaded(without dragging column to show group by)
col1 clo2 clo3
Title 1
x1 y1 z1
x2 y2 z3
Title 2
x3 x4 x5
Thanks
Rajesh...
Rajesh,
Simply add the column to the SortedColumns collection of the band, specifying that the column should be grouped, such as:
this.ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("col4", false, true);
-Matt
Matt
I tried that but it shows repeated columns in each group and with collapsed buttons.
I want to show the columns on top and dont want to repeat in each group and it should be expandable and dont want show the collapse and expand button for the group.
Rajesh..
To control the placement of the column headers, you can look at the HeaderPlacement property on the Override (i.e. this.ultraGrid1.DisplayLayout.Override.HeaderPlacement); you may want to use the 'OncePerGroupedRowIsland' value.
As for your second question, I'm not sure exactly what you mean. How can a group be expandable but then not show the expand or collapse buttons? If you mean that you want the rows to all be expanded but not allow the user to collapse them, you could use the InitializeGroupByRow event, such as:
private void ultraGrid1_InitializeGroupByRow(object sender, Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs e){ e.Row.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.Never; e.Row.Expanded = true;}
If you never want to show expansion indicators under any circumstances (i.e. even in a hierarchical grid), you could set the ExpansionIndicator property on the Override itself instead of the individual row.
Matt Thanks for your quick and prompt response.
I got all but expansion indicators still showing even I use
this.ultraGrid1.DisplayLayout.Override.ExpansionIndicator = ShowExpansionIndicator.Never;
I tried like GroupByRow also as below
{
e.Row.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.Never; e.Row.Expanded = true;
}
but still expansion indicators are showing on grid.
Sorry about that, I guess the ExpansionIndicator property doesn't seem to have any effect on the GroupByRows. Take a look at the GroupByRowExpansionStyle property on the Override instead; setting this to 'Disabled' should work.
I got it now .Thanks for ur help.