- Home
- Forum
- ASP.NET Web Forms (Classic)
- Hiding the Grouped Column
Hiding the Grouped Column
- Dec 11, 2008 04:55 PM UTC
- Dec 26, 2008 06:13 AM UTC
Hi,
I am assigning a column from my dataset as a grouped column at runtime. After assigning this column, I do not want it to appear in the grouped result set. Is there a way to hide this particular column?
I am assigning a column from my dataset as a grouped column at runtime. After assigning this column, I do not want it to appear in the grouped result set. Is there a way to hide this particular column?
SIGN IN To post a reply.
5 Replies
RS
Rajarajeswari S
Syncfusion Team
December 12, 2008 06:16 AM UTC
Hi Saurabh,
By default we can't hide or remove the columns that are grouped, but we can have a workaround with css styles.
Please refer the below code snippet which illustrates this:
.display
{
display:none;
}
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
Please refer the sample from the below link, which illustrates this:
http://websamples.syncfusion.com/samples/Grid.Web/6.4.0.15/GGC_Web_HidingGroupedColumn/main.htm
Here, if you Grouped the field "Name" and expand the records, The "Name" field gets hidden.
Please let me know if this helps you out.
Regards,
Raji
By default we can't hide or remove the columns that are grouped, but we can have a workaround with css styles.
Please refer the below code snippet which illustrates this:
.display
{
display:none;
}
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
Please refer the sample from the below link, which illustrates this:
http://websamples.syncfusion.com/samples/Grid.Web/6.4.0.15/GGC_Web_HidingGroupedColumn/main.htm
Here, if you Grouped the field "Name" and expand the records, The "Name" field gets hidden.
Please let me know if this helps you out.
Regards,
Raji
SS
Saurabh Srivastava
December 12, 2008 09:42 AM UTC
Hi,
The column disappears alright. But the column header still remains!!! How to get past that?
The column disappears alright. But the column header still remains!!! How to get past that?
RS
Rajarajeswari S
Syncfusion Team
December 15, 2008 04:35 AM UTC
Hi Saurabh,
Thanks for using Syncfusion products.
We can hide the column header too, using the below code snippet:
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.ColumnHeaderCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
But we can’t hide it from the GroupDropArea. Please have a look at the sample from the below link:
http://www.syncfusion.com/support/user/uploads/Sample_2245517e.zip
Please let me know if you have any other concerns.
Regards,
Raji
Thanks for using Syncfusion products.
We can hide the column header too, using the below code snippet:
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.ColumnHeaderCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
But we can’t hide it from the GroupDropArea. Please have a look at the sample from the below link:
http://www.syncfusion.com/support/user/uploads/Sample_2245517e.zip
Please let me know if you have any other concerns.
Regards,
Raji
SS
Saurabh Srivastava
December 23, 2008 10:57 AM UTC
Hi,
I tried the below , it hides the grouped column values, but the empty column is still present and another problem with this is that the header columns move one step left in place of the hidden column, there by we have header columns that are not insync with the data in the rest of the grid.
Please advice.
Thanks
>Hi Saurabh,
Thanks for using Syncfusion products.
We can hide the column header too, using the below code snippet:
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.ColumnHeaderCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
But we can’t hide it from the GroupDropArea. Please have a look at the sample from the below link:
http://www.syncfusion.com/support/user/uploads/Sample_2245517e.zip
Please let me know if you have any other concerns.
Regards,
Raji
I tried the below , it hides the grouped column values, but the empty column is still present and another problem with this is that the header columns move one step left in place of the hidden column, there by we have header columns that are not insync with the data in the rest of the grid.
Please advice.
Thanks
>Hi Saurabh,
Thanks for using Syncfusion products.
We can hide the column header too, using the below code snippet:
void GridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellType.ColumnHeaderCell)
{
if (e.TableCellIdentity.Column.Name == "Name")
{
if(this.GridGroupingControl1.TableDescriptor.GroupedColumns.Contains("Name"))
{
e.Style.CssClass = "display";
e.Handled = true;
}
}
}
}
But we can’t hide it from the GroupDropArea. Please have a look at the sample from the below link:
http://www.syncfusion.com/support/user/uploads/Sample_2245517e.zip
Please let me know if you have any other concerns.
Regards,
Raji
RS
Rajarajeswari S
Syncfusion Team
December 26, 2008 06:13 AM UTC
Hi Saurabh,
As I have explained you in my previous update, With GridGroupingControl we can't hide the grouped columns. But we are hidding it through css style as a work-around.
The "display:none" of css will simply hide the object visually, it won't be removed actually. And also it is default when a column is hidden the next, next columns will move one step left to fill the hidden columns space we can't avoid it.
Please let em knwo if you have any other concerns.
Regards,
Raji
As I have explained you in my previous update, With GridGroupingControl we can't hide the grouped columns. But we are hidding it through css style as a work-around.
The "display:none" of css will simply hide the object visually, it won't be removed actually. And also it is default when a column is hidden the next, next columns will move one step left to fill the hidden columns space we can't avoid it.
Please let em knwo if you have any other concerns.
Regards,
Raji
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
SS Saurabh Srivastava
- Dec 11, 2008 04:55 PM UTC
- Dec 26, 2008 06:13 AM UTC