We want to show a descriptive field as a heading column followed by a row of data - essentially grouping by one field value. The group works but want to remove the group by column.
A few searches in the forum indicates changing the column width and font size of the grouping column would effectively hide it as in the following sample:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
if (e.Column is GridGroupSplitterColumn)
{
//this doesn't do a thing
e.Column.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Pixel(0);
e.Column.HeaderStyle.Font.Size = System.Web.UI.WebControls.FontUnit.Point(1);
e.Column.ItemStyle.Width = System.Web.UI.WebControls.Unit.Pixel(0);
e.Column.ItemStyle.Font.Size = System.Web.UI.WebControls.FontUnit.Point(1);
e.Column.Resizable = false;
//this works but messes up the text grouping row:
//e.Column.Visible = false;
}
}
This doesn't work. Making the grouping column invisible DOES work but introduces a new problem. The grouping text appears in the second column. It appears a <td></td> element appears for the first column, I assume this is was used for the grouping column.
I have attached a picture to demonstrate the issue. The first image shows the grouping column using the above code. The second makes the column invisible, but now the grouping text is in the second column