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

Export to Excel and ajax

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
weezie
Top achievements
Rank 1
weezie asked on 06 Jan 2011, 11:15 PM
I have a link (lnkSearch) that is ajaxed, which populates a grid when its clicked.  (link is ajaxed using RadAjaxManager)
I also have a button (btnExport) in the grid's PagerTemplate, which when clicked does the telerik grid.masterview.ExportToExcel() command.
However, since lnkSearch is ajaxed, the ExportToExcel() command doesn't work.

The lnkSearch is outside of the grid, so the following suggested telerik workaround doesn't get fired off when the user
clicks lnkSearch.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="OnRequestStart"

<script type="text/javascript">
   function onRequestStart(sender, args)
   {
       if (args.get_eventTarget().indexOf("btnExport") >= 0)
           args.set_enableAjax(false);
   }
</script>  

I have also tried the following but it didn't help either.
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridPagerItem)
    {
        Button btnExport = (Button)e.Item.FindControl("btnExport");
        ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnExport);
    }
}

The ExportToExcel() does work when I disable ajax for the lnkSearch, which I want to avoid.

Thanks for your help!
- weezie

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 11 Jan 2011, 05:34 PM
Hello Weezie,

I tried to replicate the issue which you described, but to no avail.
Attached to this message, you will find the code which I used for testing.

Please, take a look at it and let me know if there are any differences at your end, which I may be leaving out.

All the best,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
weezie
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or