We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hiding the Grouped Column

Thread ID:

Created:

Updated:

Platform:

Replies:

78403 Dec 11,2008 04:55 PM UTC Dec 26,2008 06:13 AM UTC ASP.NET Web Forms (Classic) 5
loading
Tags: GridGroupingControl
Saurabh Srivastava
Asked On December 11, 2008 04:55 PM 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?


Rajarajeswari S [Syncfusion]
Replied On 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



Saurabh Srivastava
Replied On December 12, 2008 09:42 AM UTC

Hi,

The column disappears alright. But the column header still remains!!! How to get past that?




Rajarajeswari S [Syncfusion]
Replied On 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



Saurabh Srivastava
Replied On 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





Rajarajeswari S [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;