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

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

3 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CSurieux
Top achievements
Rank 2
CSurieux asked on 04 Nov 2009, 12:02 PM
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



3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 10 Nov 2009, 10:23 PM
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.
0
CSurieux
Top achievements
Rank 2
answered on 11 Nov 2009, 08:04 AM
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

0
Daniel
Telerik team
answered on 16 Nov 2009, 04:15 PM
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.
Tags
Grid
Asked by
CSurieux
Top achievements
Rank 2
Answers by
Daniel
Telerik team
CSurieux
Top achievements
Rank 2
Share this question
or