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

DNN, RadAjaxManager, and Buttons

4 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Valentine
Top achievements
Rank 2
John Valentine asked on 21 Mar 2008, 04:13 PM
I have followed all the posts I can find, looked at the Demo's online and tried some of them synergetically. Here is where I am at.

I have a RadGrid "Prometheus" running in a DNN module on the 3.5 framework using the OnNeedDataSource event.

The grid is using AJAX, a RadLoadingPanel, and a RadAjaxManager to handle all the AJAX events.

I am also using the RadGrid Reporting Functionalities but not within the Pager - they are image buttons on the page.

I included the two panels, one asp:panel one telerik:RadAjaxPanel and set the asp:panel's default button but that doesn't seem to work for me. So here is my code:

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<script type="text/javascript"
     
    function OnRequestStart(sender, args) 
    { 
                 
        args.set_enableAjax(true); 
     
    } 
     
    function OnResponseEnd(sender, args) 
    { 
         
        args.set_enableAjax(false); 
         
    } 
     
</script> 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="radGrid"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="radGrid" LoadingPanelID="alpGrid" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
    <ClientEvents OnRequestStart="OnRequestStart" OnResponseEnd="OnResponseEnd" /> 
</telerik:RadAjaxManager> 
<telerik:RadAjaxPanel ID="radPanel" runat="server" ClientEvents-OnRequestStart="OnResponseEnd" ClientEvents-OnResponseEnd="OnRequestStart"
    <asp:ImageButton ID="cmdExportToExcel" Style="cursor: pointer;" ImageUrl="~/DesktopModules/Slideshow/Images/excel-tips-tricks.png" 
        AlternateText="Export to Excel" runat="server"  
        onclick="cmdExportToExcel_Click"></asp:ImageButton> 
    <asp:ImageButton ID="cmdExportToWord" Style="cursor: pointer;" ImageUrl="~/DesktopModules/Slideshow/Images/word-tips-tricks.png" 
        AlternateText="Export to Word" runat="server"  
        onclick="cmdExportToWord_Click"></asp:ImageButton> 
    <asp:ImageButton ID="cmdExportToPdf" Style="cursor: pointer;" ImageUrl="~/DesktopModules/Slideshow/Images/pdf_icon.gif" Width="35px" 
        AlternateText="Export to Pdf" runat="server"  
        onclick="cmdExportToPdf_Click"></asp:ImageButton> 
    <asp:Label ID="lblExport" runat="server" /> 
</telerik:RadAjaxPanel> 
<telerik:RadAjaxLoadingPanel ID="alpGrid" runat="server" Transparency="30"
     <asp:Image ID="Image1" ImageUrl="~/DesktopModules/Slideshow/images/loading.gif" AlternateText="Loading. Please wait..." BorderWidth="0px" runat="server"></asp:Image> 
</telerik:RadAjaxLoadingPanel> 

By setting the javascript args this way, I know that the grid will behavior will exhibit AJAX functionality.

What I would like to do is use the JavaScript to disable the AJAX and produce the needed result. In this scenario if I had only one button (Excel, Pdf, or Word) everything would work fine and I wouldn't be writing this post. So here is the crux of the issue.

No matter which button I press first - the page will attempt to export that type.
so if I click excel it works. Then I decide to click pdf - it exports excel again.

If I simply change the sorting on the radGrid, then click pdf it works normally again. Then I decide to export Word. It once again attempts to export pdf.

And so on...

Obviously, there is something that is storing the export type here... I am thinking that its somewhere in the DOM. Where is it stored, and can I reset or clear it using a JavaScript function?

Thanks In Advance!

John

4 Answers, 1 is accepted

Sort by
0
John Valentine
Top achievements
Rank 2
answered on 24 Mar 2008, 03:31 PM
Hey all,

Just checking in on this post. I am actually surprised that no one has posted a reply. Can anyone help me with my problem? I am still at a loss on how to proceed.

Thanks!

John
0
Accepted
Steve
Telerik team
answered on 24 Mar 2008, 04:13 PM
Hi John,

You're correct in your observations. When RadGrid is exported, the page postbacks changing its content-type and the output is send to another application (Word, Excel, Pdf). In this case the EVENTTARGET field stays with the old value depending on the export and is not cleared until the page postbacks to itself and not to external app. To workaround this, you can use the following code:

  function OnRequestStart(sender, args)
    {       
        args.set_enableAjax(false);
  setTimeout(function(){
           form1["__EVENTTARGET"].value = "";
           }, 100);
    }

We will try to do this automatically for the official release as with the Classic RadAjax. Your Telerik points have been updated for pointing this out.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John Valentine
Top achievements
Rank 2
answered on 24 Mar 2008, 04:45 PM
Thats it. Of coarse... the content-type is being retained just as I suspected. All I had to do was clear the event target at the start of the request so the content-type would be reset to the appropriate type. I don't know why that was not apparent to me until now.

It was so simple - I guess I just couldn't see the forest for the trees... Thanks.

Cheers!

John


0
Allen
Top achievements
Rank 2
Iron
Veteran
answered on 14 Jun 2015, 11:17 PM

This seems to say that your RadAjaxPanel conflicts with your RadAjaxManager.  Either 1 but not both, and if RadAjaxManager, then use a plain old asp:Panel. 

http://docs.telerik.com/devtools/aspnet-ajax/controls/ajax/radajaxmanager/troubleshooting/controls-wrapped-in-ajaxpanel-and-added-to-ajaxmanager-settings

Tags
Grid
Asked by
John Valentine
Top achievements
Rank 2
Answers by
John Valentine
Top achievements
Rank 2
Steve
Telerik team
Allen
Top achievements
Rank 2
Iron
Veteran
Share this question
or