DNN, RadAjaxManager, and Buttons

5 posts, 1 answers
  1. John Valentine
    John Valentine avatar
    15 posts
    Member since:
    Jun 2007

    Posted 21 Mar 2008 Link to this post

    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) 
        function OnResponseEnd(sender, args) 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <telerik:AjaxSetting AjaxControlID="radGrid"
                    <telerik:AjaxUpdatedControl ControlID="radGrid" LoadingPanelID="alpGrid" /> 
        <ClientEvents OnRequestStart="OnRequestStart" OnResponseEnd="OnResponseEnd" /> 
    <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"  
        <asp:ImageButton ID="cmdExportToWord" Style="cursor: pointer;" ImageUrl="~/DesktopModules/Slideshow/Images/word-tips-tricks.png" 
            AlternateText="Export to Word" runat="server"  
        <asp:ImageButton ID="cmdExportToPdf" Style="cursor: pointer;" ImageUrl="~/DesktopModules/Slideshow/Images/pdf_icon.gif" Width="35px" 
            AlternateText="Export to Pdf" runat="server"  
        <asp:Label ID="lblExport" runat="server" /> 
    <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> 

    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!

  2. John Valentine
    John Valentine avatar
    15 posts
    Member since:
    Jun 2007

    Posted 24 Mar 2008 Link to this post

    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.


  3. Answer
    Steve avatar
    10940 posts

    Posted 24 Mar 2008 Link to this post

    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)
               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,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. John Valentine
    John Valentine avatar
    15 posts
    Member since:
    Jun 2007

    Posted 24 Mar 2008 Link to this post

    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.



  5. Allen
    Allen avatar
    82 posts
    Member since:
    Mar 2011

    Posted 14 Jun 2015 in reply to John Valentine Link to this post

    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. 


Back to Top