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

open a new window on telerik Radmenu item click

6 Answers 348 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 24 Feb 2020, 06:23 PM

I have rad menu item and it has couple of items in it. When we click on a Item , a new window should be open without server trip.

 

Note: telerik controls placed in a user control.

 

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Feb 2020, 12:34 PM

Hi Chad,

You can use the OnClientItemClicked client event of RadMenu to open an instance of RadWindow or window.open when clicking of the menu item. 

An example is available in this forum thread: Open RadWindow with a RadMenu, e.g.

<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
<telerik:RadMenu ID="RadMenu1" runat="server" Style="left: 1px; top: -1px" Width="100%" OnClientItemClicked="MenuOpenWindow">
    <Items>
        <telerik:RadMenuItem runat="server" Text="Change Password" ImageUrl="~/img/key.png" Value="Change Password"></telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>
<script type="text/javascript">
    function MenuOpenWindow(sender, eventArgs) {
        if (eventArgs.get_item().get_text() == "Change Password") {
            radopen(null, "Window1");
            return false;
        }
    }
</script>

Best Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
Chad
Top achievements
Rank 1
answered on 27 Feb 2020, 05:54 PM

Hi Rumen,

my previous issue got resolved with ClientEvent OnResponseEnd and with OnAjaxRequest and its working fine in IE but not in firefox.

Here is the issue (only in Firefox):

I am disabling Ajax on OnRequestStart function and it is not updating client side hidden fields which is coming from server side.

 

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <ClientEvents OnRequestStart="mngRequestStarted"  OnResponseEnd="GetHiddenFieldValue" />

 

 function mngRequestStarted(ajaxManager, eventArgs) {          
            if (eventArgs.EventTarget == "<%= RadMenuOptions.UniqueID%>") {
                if (currentMenuItem) {
                    if (currentMenuItem == "CSV" || currentMenuItem == "CSVAll" || currentMenuItem == "Excel" || currentMenuItem == "Word" || currentMenuItem == "PDF") {                         
                        eventArgs.EnableAjax = false;                       
                    }
                }
            }
        }

if I set eventArgs.EnableAjax = true  client side function is working but not server side . this issue is happening only in FireFox.

can you help on this.

 

0
Chad
Top achievements
Rank 1
answered on 27 Feb 2020, 08:28 PM

Rumen,

 

I have one more issue with RadAjaxLoadingPanel. this Loading panel is not closing/hiding at all in Firefox (working fine in IE). 

is there a way that we can hide loading panel in FireFox?

 

Thanks in advance.

 

0
Rumen
Telerik team
answered on 02 Mar 2020, 01:38 PM

Hi Chad,

You can either test with the latest version of Telerik Web UI (R1 2020 SP1) or directly hide the loading panel as shown at the Show and Hide AjaxLoadingPanel explicitly article.

Best regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
Chad
Top achievements
Rank 1
answered on 02 Mar 2020, 05:42 PM

Hi Rumen,

 

 

when I am setting eventArgs.EnableAjax = false on RequestStarted,  downloading an excel file from server side is working but window.open is not working. If I set eventArgs.EnableAjax = true winodw.open is working but  downloading an excel file from server side is not working.

is there a way to open a new window (Window.Open) using JavaScript  while downloading a Excel/CSV file from Server side?

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <ClientEvents OnRequestStart="mngRequestStarted"  OnResponseEnd="GetHiddenFieldValue" />

 

======

  function mngRequestStarted(ajaxManager, eventArgs) {           

            if (eventArgs.EventTarget == "<%= RadMenuOptions.UniqueID%>") { 
                if (currentMenuItem) {
                    if (currentMenuItem == "CSV" || currentMenuItem == "CSVAll" || currentMenuItem == "Excel" || currentMenuItem == "Word" || currentMenuItem == "PDF") {                        
                       eventArgs.EnableAjax = false;                        
                    }
                }
            }           

        }

=====

 

 

 

 

0
Rumen
Telerik team
answered on 05 Mar 2020, 01:59 PM

Hi Chad,

Indeed, those are 2 requirements that are mutually exclusive due to the Ajax:

  • export
  • window

The export can't handle ajax, so EnableAjax="false" is 100% a must.

Usually, when a file is being downloaded, the server clears the response and responds with the file to download which is the reason for the reported issue. You can find an article on the matter at Use cookies to help execute custom JavaScript after a file starts to download.

If there is a different logic for the client and the server, what you can do/try is:

  • Remove auto postback from RadMenu item click and keep only client-side logic
  • Once the window logic is complete, you can use the fireCommand grid method to achieve the remaining logic in the server (without AJAX for exporting) 

    If there are still problems, please open a support ticket and send us a simple runnable repro project which demonstrates the problem.

Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Chad
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Chad
Top achievements
Rank 1
Share this question
or