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

Code to prevent groups from being collapsed not working

2 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 22 Jul 2009, 10:33 AM
Hi

I have a grouped grid and I am trying to prevent the groups from being collapsed by hiding the expand collapse button. I have followed the info in the help file and i have tried both approaches (column created event and grid pre render event) but the column is refusing to disappear!

    Protected Sub gridJourneys_ColumnCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles gridJourneys.ColumnCreated  
        If TypeOf e.Column Is GridGroupSplitterColumn Then  
            e.Column.HeaderStyle.Width = Unit.Pixel(0)  
            e.Column.HeaderStyle.Font.Size = FontUnit.Point(0)  
            e.Column.ItemStyle.Width = Unit.Pixel(0)  
            e.Column.ItemStyle.Font.Size = FontUnit.Point(0)  
            e.Column.Resizable = False 
 
        End If  
    End Sub  
 
    Private Sub gridJourneys_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles gridJourneys.PreRender  
 
        For Each column As GridColumn In gridJourneys.MasterTableView.RenderColumns  
            If (TypeOf column Is GridGroupSplitterColumn) Then  
 
                column.HeaderStyle.Width = Unit.Pixel(0)  
                column.HeaderStyle.Font.Size = FontUnit.Point(0)  
                column.ItemStyle.Width = Unit.Pixel(0)  
                column.ItemStyle.Font.Size = FontUnit.Point(0)  
                column.Resizable = False 
            End If  
        Next  
    End Sub 

The code is detecting the GridGroupSplitterColumn in both cases but it is not affecting the column appearance. In fact i can't make the column any bigger in those code snippets either.

I have set the client side resizable property to true

Here is the grid in case there are any pertinent properties you need to see there

<telerik:RadGrid ID="gridJourneys" runat="server"  Width="960px" AutoGenerateColumns="False" GridLines="None" skin="SkyBlue">  
<MasterTableView DataKeyNames="JourneyID" CommandItemDisplay="Top" Name="Journeys" ShowFooter="True" ShowGroupFooter="True" > 
 <CommandItemTemplate> 
 <table cellpadding="5" cellspacing="0">  
 <tr> 
 <td colspan="2"<span class="title"><asp:Label ID="lblTitle" runat="server" Text="Title"></asp:Label></span</td> 
 </tr> 
 <tr> 
    <td>No Journeys</td> 
    <td><asp:Label ID="lblNoJourneys" runat="server"></asp:Label></td>  
 </tr> 
 <tr> 
    <td>Total Distance</td> 
    <td><asp:Label ID="lblTotalDistance" runat="server"></asp:Label></td>  
 </tr> 
 <tr> 
    <td>Total Time</td> 
    <td><asp:Label ID="lblTotalDuration" runat="server"></asp:Label></td>  
 </tr> 
 
 </table> 
 <br /> 
  </CommandItemTemplate> 
 
<NoRecordsTemplate> 
There are no journeys on this date.  
                
</NoRecordsTemplate> 
 
<GroupByExpressions> 
<telerik:GridGroupByExpression> 
<SelectFields> 
<telerik:GridGroupByField  FieldName="StartDate"  FieldAlias="StartDate" FormatString="" HeaderText=""/>  
<telerik:GridGroupByField FieldAlias="TotalDistance" Aggregate="Sum" FieldName="DistanceTravelled" FormatString="" HeaderText=""   /> 
<telerik:GridGroupByField FieldAlias="TotalTime" Aggregate="Sum" FieldName="TimeTakenInSeconds" FormatString="" HeaderText=""   /> 
<telerik:GridGroupByField FieldAlias="Count" Aggregate="Count" FieldName="JourneyID" FormatString="" HeaderText="" /> 
</SelectFields> 
<GroupByFields> 
<telerik:GridGroupByField  FieldName="StartDate" FieldAlias="StartDate" FormatString="" HeaderText=""/>  
</GroupByFields> 
</telerik:GridGroupByExpression> 
</GroupByExpressions> 
 
 
<Columns> 
     <telerik:GridBoundColumn DataField="JourneyID" Aggregate="Count" Visible="False" FooterAggregateFormatString="{0}" UniqueName="JourneyID"></telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="StartDateTime" DataFormatString="{0:dd/MM/yy HH:mm}" HeaderText="Start Time" UniqueName="StartDateTime">  
        <ItemStyle Width="100px" /> 
    </telerik:GridBoundColumn> 
    <telerik:GridTemplateColumn HeaderText="Start Location" UniqueName="StartLocation">  
    <ItemTemplate> 
                <asp:label runat="server" id="lblStartLocation"/>  
    </ItemTemplate> 
        <ItemStyle Width="280px" /> 
</telerik:GridTemplateColumn> 
<telerik:GridBoundColumn DataField="EndDateTime"  DataFormatString="{0:dd/MM/yy HH:mm}" HeaderText="End Time" UniqueName="EndDateTime">  
    <ItemStyle Width="100px" /> 
</telerik:GridBoundColumn> 
<telerik:GridTemplateColumn HeaderText="End Location" UniqueName="EndLocation" > 
<ItemTemplate> 
  <asp:label runat="server" id="lblEndLocation"/>  
      
</ItemTemplate> 
    <ItemStyle Width="280px" /> 
</telerik:GridTemplateColumn> 
 
<telerik:GridBoundColumn DataField="TimeTakenInSeconds" DataFormatString="{0}" UniqueName="TimeTakenInSeconds" Aggregate="Sum" FooterAggregateFormatString="{0}" Visible="False" > 
</telerik:GridBoundColumn> 
 
<telerik:GridBoundColumn HeaderText="Duration" DataField="TimeTaken" UniqueName="TimeTaken">  
 <ItemStyle Width="100px" /> 
</telerik:GridBoundColumn> 
 
<telerik:GridBoundColumn DataField="DistanceTravelled" DataFormatString="{0:F2}" HeaderText="Distance" UniqueName="DistanceTravelled" Aggregate="Sum" FooterAggregateFormatString="{0:F2}">  
    <ItemStyle Width="100px" /> 
</telerik:GridBoundColumn> 
 
 
 
 
</Columns> 
</MasterTableView> 
    <HeaderContextMenu EnableEmbeddedSkins="False" Skin="SureTrack">  
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </HeaderContextMenu> 
    <ClientSettings> 
        <Resizing AllowColumnResize="True" /> 
    </ClientSettings> 
    <FilterMenu EnableEmbeddedSkins="False" Skin="SureTrack">  
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </FilterMenu> 
</telerik:RadGrid> 

I am using q3 2008.

many thanks

2 Answers, 1 is accepted

Sort by
0
andieje
Top achievements
Rank 1
answered on 22 Jul 2009, 10:55 AM
Hi

I found this old thread from when i had this same problem last year

http://www.telerik.com/community/forums/aspnet-ajax/grid/can-t-hide-expand-and-collapse-images-in-radgrid.aspx

None of the solutions suggested by Telerik worked for me. The only thing that solved the problem was to add this to my aspx page

.RadGrid_SureTrack

 

.rgCollapse

 

{

 

visibility:hidden !important;

 

}

</

 

style>

 


I would respectfully request that telerik include this tip in their help documentation. As someone from teh telerik team has said in the post referred to above, thsi area of the docs does need updating so i hope this could be added too in case it helps someone else when the other ideaa fail
0
Daniel
Telerik team
answered on 27 Jul 2009, 08:12 PM
Hello Andieje,

Thank you for your suggestion. We already modified the depicted help article. The updated version will be uploaded as soon as possible.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
andieje
Top achievements
Rank 1
Answers by
andieje
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or