This is a migrated thread and some comments may be shown as answers.

Clear group columns

5 Answers 282 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santiago Rial Iglesias
Top achievements
Rank 1
Santiago Rial Iglesias asked on 30 Jul 2008, 01:16 PM

Hi,

How I can remove the group columns from code?

Kind Regards.

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 30 Jul 2008, 04:58 PM
Hello Santiago,

I am not sure what you are talking about. Do you mean you want to hide the GridGroupSplitterColumn?

http://www.telerik.com/help/aspnet-ajax/grid-prevent-groups-expansion.html

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Santiago Rial Iglesias
Top achievements
Rank 1
answered on 30 Jul 2008, 07:03 PM
I need restore default grid view without grouping.

After executing the method grid.Rebind() the grouping columns do not disappear.

Kind Regards.
0
Vladimir
Top achievements
Rank 1
answered on 30 Jul 2008, 07:08 PM
Hi  Santiago,

You need to clear group expressions similar to this example:
http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/GroupBy/Expressions/DefaultCS.aspx

Vlad
0
Joze Mlakar
Top achievements
Rank 1
answered on 11 Nov 2008, 10:04 AM
Hi!

I tried to hide the GridGroupSplitterColumn like explained in http://www.telerik.com/help/aspnet-ajax/grdpreventgroupsexpansion.html, but it doesn't work. Am I missing something?

Regards, J.

Telerik.Web.UI version is 2008.2.826.35
Page code:
<%@ Page Language="C#" %> 
 
<%@ Register Assembly="Telerik.Web.UI, Version=2008.2.826.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
  Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<script runat="server"
 
  protected void radGrid_ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e) { 
    if (e.Column is GridGroupSplitterColumn) { 
      e.Column.HeaderStyle.Width = Unit.Pixel(1); 
      e.Column.HeaderStyle.Font.Size = FontUnit.Point(1); 
      e.Column.ItemStyle.Width = Unit.Pixel(1); 
      e.Column.ItemStyle.Font.Size = FontUnit.Point(1); 
      e.Column.Resizable = false
    } 
  } 
 
  protected void radGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { 
    if (e.Item is GridGroupHeaderItem) { 
      GridGroupHeaderItem item = e.Item as GridGroupHeaderItem; 
      if (item.GroupIndex.Split('_').Length == 4) { 
        e.Item.BackColor = System.Drawing.Color.Beige; 
      } 
      else if (item.GroupIndex.Split('_').Length == 3) { 
        e.Item.BackColor = System.Drawing.Color.Bisque; 
      } 
      else if (item.GroupIndex.Split('_').Length == 2) { 
        e.Item.BackColor = System.Drawing.Color.AliceBlue; 
      } 
      else if (item.GroupIndex.Split('_').Length == 1) { 
        e.Item.BackColor = System.Drawing.Color.Coral; 
      } 
    } 
  } 
 
</script> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
  <title>Grid Test</title> 
</head> 
<body> 
  <form id="form1" runat="server"
  <div> 
    <asp:ScriptManager ID="scriptManager" runat="server" /> 
    <asp:XmlDataSource ID="xmlDataSourceWebSite" runat="server" XPath="WebSites/WebSite"
      <Data> 
      <?xml version="1.0" encoding="utf-8" ?> 
        <WebSites> 
          <WebSite Name="MS" Url="http://www.microsoft.com" Type="Software" /> 
          <WebSite Name="telerik" Url="http://www.telerik.com" Type="Software" /> 
          <WebSite Name="Google" Url="http://www.google.com" Type="Search engine" /> 
          <WebSite Name="Yahoo!" Url="http://www.yahoo.com" Type="Search engine" /> 
        </WebSites> 
      </Data> 
    </asp:XmlDataSource> 
    <telerik:RadGrid ID="radGrid" runat="server" DataSourceID="xmlDataSourceWebSite" 
      Skin="Office2007" OnColumnCreated="radGrid_ColumnCreated" OnItemDataBound="radGrid_ItemDataBound"
      <ClientSettings> 
        <Resizing AllowColumnResize="true" /> 
      </ClientSettings> 
      <MasterTableView> 
        <GroupByExpressions> 
          <telerik:GridGroupByExpression> 
            <GroupByFields> 
              <telerik:GridGroupByField FieldName="Type" /> 
            </GroupByFields> 
            <SelectFields> 
              <telerik:GridGroupByField FieldName="Type" /> 
            </SelectFields> 
          </telerik:GridGroupByExpression> 
        </GroupByExpressions> 
      </MasterTableView> 
    </telerik:RadGrid> 
  </div> 
  </form> 
</body> 
</html> 

0
Yavor
Telerik team
answered on 11 Nov 2008, 10:52 AM
Hi Joze,

Attached to this message, is a small application, which handles one possible approach for this scenario.
I hope it helps.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Santiago Rial Iglesias
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Santiago Rial Iglesias
Top achievements
Rank 1
Vladimir
Top achievements
Rank 1
Joze Mlakar
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or