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

Using onserverclick in PagerTamplate to export Grid to CSV

1 Answer 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 17 Sep 2015, 10:48 PM

I am using a RadGrid element and need to export CSV data from it. When I place a link outside of the RadGrid element, the export works fine: 

<a title="Export" onserverclick="Export_CSV_Click" runat="server" class="icon-msexcelexport icon" href="#"></a>

<telerik:RadGrid ID="myGrid" runat="server" EnableViewState="false">

etc...

Now when I place that same link within the PagerTemplate, it no longer works and I get a javascript popup error.

<telerik:RadGrid ID="myGrid" runat="server" EnableViewState="false">

    <MasterTableView

        <PagerTemplate>

            <a title="Export" onserverclick="Export_CSV_Click" runat="server" class="icon-msexcelexport icon" href="#"></a>

 

 

And the export method..

protected void Export_CSV_Click(object sender, System.EventArgs e)

{

     myGrid.MasterTableView.ExportToCSV();

}

 

How would I get this button working from within the PagerTemplate?

 
 

 
 
 
 
 
 
 
 
 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Sep 2015, 04:10 PM
Hello Chris,

I believe that this should be working properly except in the case where your RadGrid has been ajax enabled. In this case you should stop ajax when exporting as explained here:
Export from Ajaxified Grid

I hope this helps.

Regards,
Daniel
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or