2009.Q3 still some efforts needed improving usage of RadGrid Export

4 posts, 0 answers
  1. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 04 Nov 2009 Link to this post

    Hello,

    RadGrid is a good tool ...but could be improved.

    I discovered the finally integrated buttons to export to Excel, Word,pdf,csv...perfect.
    But I am still disapointed we still have to add manually javascript to the page:
    <script type="text/javascript">  
                function onRequestStart(sender, args)  
                {  
                    if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||  
                        args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||  
                        args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 ||  
                        args.get_eventTarget().indexOf("ExportToCsvButton") >= 0)  
                    {  
     
                        args.set_enableAjax(false);  
                    }  
                }  
            </script> 
     

    This should be done by control !

    And we should have a way to add from codebehind several javascript functions which would be called OnRequestStart.


    Thanks Telerik for this tool but thanks doing some more efforts.

    CS



  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 10 Nov 2009 Link to this post

    Hello Christian,

    Thank you for sharing your opinion.

    Although such option would be useful, it is a bit tricky to be implemented. As far as I know, there is no feasible approach that would have been suitable for both Telerik and ASP.NET controls.

    At this point, I can only suggest you simplify your code a bit:
    <script type="text/javascript">   
       function onRequestStart(sender, args)   
       {   
          if (args.get_eventTarget().indexOf("ExportTo") != -1)
             args.set_enableAjax(false);   
       }   
    </script>

    Regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 11 Nov 2009 Link to this post

    Thank you Daniel ,

    Even if your answer is a kind of dummy RTFM.
    You know I have in my code dozen of small pieces of javascript to maintain.
    And I prefer maintaining C# than javascript for many good reasons.

    If I only consider the Ajax OnrequestStart, it is already used:
    1) to center a loading panel,
    2) to avoid Radgrid Export buttons doing callback
    3) To avoid some Radprogress to fire when a callback is unnecessary....
    etc.

    My pages are loaded dynamically via user controls under a limited number of pages/masterpages containers, so it is uneasy to change the OnRequestStart for each special module need, and I must include all possibilities in an ever growing OnRequestStart.
    Having a kind of general container for javascript to trigger on Ajax request start, and allowing to fill it dynamically on each request would be better.
    Are you sure that nothing could be done to improve this.

    Best regards.

    Christian

  5. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 16 Nov 2009 Link to this post

    Hello Christian,

    I believe I understand your position well. There are various ways you could reuse the code, thus avoiding unnecessary repetitions. The attached demo implements one of the possible approaches - there is only a single line in the main file (Default2.aspx) - all javascript reside in external file, thus ensuring the code is easy to maintain.
    I hope this helps.

    Regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top