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

ContextMenu does not include sort options

5 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
toddhd
Top achievements
Rank 1
toddhd asked on 10 Nov 2010, 04:31 PM
I added context menu to a page on my website, and added EnableHeaderContextMenu="true" to my parameters. But when I right click on the grid, the menu does not show any sorting options. I have this same MasterTableView on another page in the site, and it works fine. The two look the same.

<MasterTableView Width="100%" TableLayout="Auto" NoMasterRecordsText="No Items Found"
    AllowAutomaticInserts="false" AllowMultiColumnSorting="false" AutoGenerateColumns="false" EnableHeaderContextMenu="true"
    AllowPaging="true" PageSize="20" AllowSorting="true" DataKeyNames="OrderID"
    CommandItemSettings-RefreshText="Refresh List" CommandItemDisplay="Top" PagerStyle-Position="TopAndBottom"
    CommandItemSettings-ShowAddNewRecordButton="false">

The only functional difference on this page is that the grid is not initially loaded with data. It is a search page. However, even once a search is performed and data is in the grid, there are no sort options.

Any ideas?

5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 11 Nov 2010, 04:57 PM
Hello Todd,

This behavior is not expected. Could you paste your entire aspx and code behind. Thanks in advance.

Greetings,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
toddhd
Top achievements
Rank 1
answered on 11 Nov 2010, 06:21 PM
I'm not opposed to sending you sample of the code, but this is proprietary information and I can't post it on a public board like this. Please let me know how I can send it to you personally.
0
Tsvetoslav
Telerik team
answered on 12 Nov 2010, 10:41 AM
Hi Todd,

You can open up a formal support ticket and send your files as an attachment.

Greetings,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rayne
Top achievements
Rank 1
answered on 08 Mar 2018, 01:14 PM

This is an old thread, but I am now having the same problem. Sort options do not appear in the HeaderContextMenu. I'm using the latest version .

Here is my grid markup:

<telerik:RadGrid runat="server" ID="gridRequests" AutoGenerateColumns="False" FilterType="HeaderContext" OnItemCommand="gridRequests_OnItemCommand" AllowSorting="True">
                <MasterTableView ItemType="demnbr.Data.Request" SelectMethod="GetRequests" DataKeyNames="RequestId" EnableHeaderContextMenu="True" EnableHeaderContextFilterMenu="True"
                    AllowSorting="True" AllowNaturalSort="True" PageSize="20" AllowPaging="True" IsFilterItemExpanded="False" AllowFilteringByColumn="True">
                    <ItemStyle Wrap="True"></ItemStyle>
                    <PagerStyle AlwaysVisible="True"></PagerStyle>
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="DateRequested" SortOrder="Descending"/>
                    </SortExpressions>
                    <Columns>
                        <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="EditRequest" Text="" ButtonCssClass="glyphicon glyphicon-pencil" UniqueName="EditRequestButton" EnableHeaderContextMenu="False" />
                        <telerik:GridBoundColumn DataField="RequestId" AllowFiltering="False" Display="False"/>
                        <telerik:GridBoundColumn DataField="DateRequested" DataFormatString="{0:MM/dd/yyyy HH:mm tt}" HeaderText="Date Requested" />
                        <telerik:GridBoundColumn DataField="Requestor.FullName" HeaderText="Requested By" ItemStyle-Wrap="False"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" HeaderStyle-Width="300px"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="EstimatedAmount" DataFormatString="{0:C}" HeaderText="Estimated $"/>
                        <telerik:GridBoundColumn DataField="FundCode" HeaderText="Fund Code"/>
                        <telerik:GridBoundColumn DataField="VendorName" HeaderText="Vendor Name"/>
                        <telerik:GridBoundColumn DataField="VendorID" HeaderText="Vendor Tax ID" Display="False"/>
                        <telerik:GridBoundColumn DataField="Status" HeaderText="Status"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="DemNumber" HeaderText="DEM #" ItemStyle-Wrap="False"/>
                        <telerik:GridBoundColumn DataField="Approver.FullName" HeaderText="Approver" Display="False"/>
                        <telerik:GridBoundColumn DataField="DateApproved" HeaderText="Decision Date" DataFormatString="{0:MM/dd/yyyy}" Display="False"/>
                        <telerik:GridBoundColumn DataField="Comments" HeaderText="Notes" Display="False"/>
                        <telerik:GridBoundColumn DataField="TotalPaid" DataFormatString="{0:C}" HeaderText="Total Paid" Display="False"/>
                        <telerik:GridBoundColumn DataField="DatePaid" HeaderText="Date Paid" DataFormatString="{0:MM/dd/yyyy}" Display="False"/>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

Even when I remove the sortExpression, it still does not show up. I have verified this in both IE11 and Chrome in Windows 7

0
Rayne
Top achievements
Rank 1
answered on 08 Mar 2018, 01:32 PM

OK. Apparently it requires AllowSorting="True" to be on the Grid, not just on the MasterTableView. I added that to my code before I posted it above, but didn't realize that was the key to making it work.

So what is the difference between the Grid and the MasterTableView and when are we supposed to add which properties where?

Tags
Grid
Asked by
toddhd
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
toddhd
Top achievements
Rank 1
Rayne
Top achievements
Rank 1
Share this question
or