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

Column headers vanishing with allowsorting=true

1 Answer 15 Views
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 29 Nov 2018, 09:53 PM

Using objectdatasource.  Found a thread from a while ago about adding the  OverrideDataSourceControlSorting="true".  Still makes our column headers disappear and not sortable. Any thoughts would be great.

Thanks

  <telerik:RadGrid ID="gridExemptions" AllowSorting="true" OnItemCreated="gridExemptions_ItemCreated" OnItemInserted="gridExemptions_ItemInserted" runat="server" OnItemDataBound="gridExemptions_ItemDataBound" CellSpacing="-1" DataSourceID="ExemptionsObjectDataSources" GridLines="Both" OnItemCommand="gridExemptions_ItemCommand" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateColumns="False" AllowMultiRowEdit="True" ShowFooter="True" OnPreRender="AnyGrid_PreRender">

            <MasterTableView OverrideDataSourceControlSorting="true" DataSourceID="ExemptionsObjectDataSources" CommandItemDisplay="TopAndBottom" InsertItemDisplay="Bottom" DataKeyNames="Exemption_ID" EditMode="InPlace" AutoGenerateColumns="False" EnableHeaderContextMenu="True">
                <CommandItemSettings ShowExportToPdfButton="True" ShowExportToCsvButton="True" ShowPrintButton="true"></CommandItemSettings>
                <Columns>
                    <telerik:GridBoundColumn DataField="Exemption_ID" HeaderText="Exemption_ID" SortExpression="Exemption_ID" UniqueName="Exemption_ID" DataType="System.Int64" FilterControlAltText="Filter Exemption_ID column" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Dealer_ID" HeaderText="Dealer_ID" SortExpression="Dealer_ID" UniqueName="Dealer_ID" DataType="System.Int64" FilterControlAltText="Filter Dealer_ID column" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DealerCode" HeaderText="DealerCode" SortExpression="DealerCode" UniqueName="DealerCode" FilterControlAltText="Filter DealerCode column" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ServiceName" HeaderText="ServiceName" SortExpression="ServiceName" UniqueName="ServiceName" FilterControlAltText="Filter ServiceName column"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ServiceCode" HeaderText="ServiceCode" SortExpression="ServiceCode" UniqueName="ServiceCode" FilterControlAltText="Filter ServiceCode column"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ExemptionAmount_Annual" DataFormatString="{0:F3}" HeaderText="ExemptionAmount_Annual" SortExpression="ExemptionAmount_Annual" UniqueName="ExemptionAmount_Annual" DataType="System.Decimal" FilterControlAltText="Filter ExemptionAmount_Annual column"></telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="StartDate" HeaderText="StartDate" SortExpression="StartDate" ReadOnly="true" UniqueName="StartDate" DataType="System.DateTime" FilterControlAltText="Filter StartDate column" DataFormatString="{0:d}"></telerik:GridDateTimeColumn>
                    <telerik:GridDateTimeColumn DataField="EndDate" HeaderText="EndDate" SortExpression="EndDate" ReadOnly="true" UniqueName="EndDate" DataType="System.DateTime" FilterControlAltText="Filter EndDate column" DataFormatString="{0:d}"></telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="Comments" HeaderText="Comments" SortExpression="Comments" UniqueName="Comments" FilterControlAltText="Filter Comments column"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ColumnGroupName="End" FilterControlAltText="Filter End column" CommandName="End" CommandArgument="End" UniqueName="End"></telerik:GridButtonColumn>
                    <telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn" ColumnGroupName="GridEditCommandColumn"></telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 04 Dec 2018, 01:09 PM
Hi Jim,

We would require some more information about the scenario. Is the column header hidden at all times or it is getting hidden after sorting? Is there by any chance a logic in the code behind that would hide the GridHeaderItem depending on a condition?

It would be very helpful, If you could describe us the steps so that we can re-produce the error on our side.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or