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

Menu re-opens after exporting from a grid

2 Answers 50 Views
Menu
This is a migrated thread and some comments may be shown as answers.
bdrennen
Top achievements
Rank 1
bdrennen asked on 06 Apr 2017, 05:30 PM

I have a page with a RadGrid. Several functions for the grid are in a RadMenu. Several of the functions trigger a JavaScript function to open dialogs, windows, and whatnot, while another menu item does a postback to export the contents of the grid to a .csv file. Everything works fine, with the exception of the export. The menu works properly up to the point where the postback completes and the .csv begins downloading. At that point, the menu re-opens with the Export item highlighted. Is there any way to keep the menu from re-opening after the export is complete?

Here's my menu:

<telerik:RadMenu ID="RadMenu1" runat="server"
    ExpandDelay="0"
    CollapseDelay="0"
    ExpandAnimation-Type="None"
    CollapseAnimation-Type="None"
    ShowToggleHandle="true"
     
    OnItemClick="RadMenu1_ItemClick"
    OnClientItemClicking="OnClientItemClicking"
    ClickToOpen="true"
     
    Skin="Windows7"
>
    <Items>
        <telerik:RadMenuItem Text="Menu" PostBack="false">
            <Items>
                <telerik:RadMenuItem Text="Save..." />
                <telerik:RadMenuItem Text="Save As..." Enabled="false" Visible="false" />
                <telerik:RadMenuItem Text="Delete" Enabled="false"/>
 
                <telerik:RadMenuItem Text="|" runat="server" IsSeparator="True" />
 
                <telerik:RadMenuItem Text="Schedule..." />
                <telerik:RadMenuItem Text="Export" />
                <telerik:RadMenuItem Text="Print" />
 
                <telerik:RadMenuItem Text="|" runat="server" IsSeparator="True" />
 
                <telerik:RadMenuItem Text="Reset Grid" />
            </Items>
        </telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>

 

Here's the JavaScript that sits behind the menu:

 

function OnClientItemClicking(sender , args) {
    var itemText = args.get_item().get_text();
 
    switch(itemText) {
        case "Save...":
            args.set_cancel(true); // Cancel postback
            window.radopen("SaveQueryForm.aspx?KEY=<%= _queryKey %>&user=<%= _username %>&saveKey=<%= _saveKey %>", "RadWindow1");
            break;
        case "Save As...":
            args.set_cancel(true); // Cancel postback
            window.radopen("SaveQueryForm.aspx?KEY=<%= _queryKey %>&user=<%= _username %>", "RadWindow1");
            break;
        case "Delete":
            args.set_cancel(true); // Cancel postback
            window.radopen("DeleteQueryForm.aspx?savekey=<%= _saveKey %>&&user=<%= _username %>", "RadWindow2");
            break;
        case "Schedule...":
            args.set_cancel(true); // Cancel postback
            window.radopen("ScheduleForm.aspx?KEY=<%= _saveKey %>&user=<%= _username %>", "RadWindow3");
            break;
        case "Print":
            args.set_cancel(true); // Cancel postback
            openForm();
            break;
    } // end switch
 
    if (itemText != "Menu") {
        closeMenu();
    } // end if
} // end OnClientItemClicking
 
function closeMenu() {
    var menu = $find("<%=RadMenu1.ClientID %>");
    var item = menu.findItemByText("Menu");
    item.close();
 
    setTimeout(function() {
        menu.close();
    }, 0);
} // end closeMenu

 

The codebehind that handles the export:

protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e) {
    switch (e.Item.Text) {
        case "Export":
            exportGridToCSV();
            break;
    } // end switch
} // end RadMenu1_ItemClick
 
protected void exportGridToCSV() {
    RadGrid1.ExportSettings.ExportOnlyData = false;
    RadGrid1.ExportSettings.IgnorePaging = true;
    RadGrid1.ExportSettings.OpenInNewWindow = true;
    RadGrid1.ExportSettings.FileName = ("Student Data Export - " + DateTime.Now.ToShortDateString()).Replace(' ', '_');
 
    RadGrid1.MasterTableView.ExportToCSV();
 
} // end exportGridToCSV

 

Any ideas on what I can do to keep the menu from re-opening after the export?

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 11 Apr 2017, 08:05 AM
Hello,

This is a known issue and it has been logged for fixing. It is a regression and it is working correctly with 2016 R2 504 You may use the following Ideas & Feedback Portal item to track its status, vote for it and add comments. I am afraid that currently there is no workaround for this issue.

Feel free to contact us again, if you have any questions.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
bdrennen
Top achievements
Rank 1
answered on 11 Apr 2017, 04:11 PM

Aha! Thank you for letting me know there currently isn't a workaround--this was driving me batty. I'll keep a lookout for the fix in a future release.

Tags
Menu
Asked by
bdrennen
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
bdrennen
Top achievements
Rank 1
Share this question
or