New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Disable Scrolling/UseStaticHeaders on PDFExport

Environment

Product Version 2019.3.1023
Product RadGrid for ASP.NET AJAX

Description

As noted in the PDF Export Q&A, when the PDF Export produces a blank page, this is because of the ClientSettings for Scrolling and UseStaticHeaders. These need to be disabled. See the below solution.

Solution

Use the ItemCommand Grid Event to temporarily disable these features. After the command executes the settings will revert back to those set on the grid.

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExportToPdfCommandName)
    {
        RadGrid1.ClientSettings.Scrolling.AllowScroll = false;
        RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = false;
        RadGrid1.Rebind();
    }
}
Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
    If e.CommandName = RadGrid.ExportToPdfCommandName Then
        RadGrid1.ClientSettings.Scrolling.AllowScroll = False
        RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = False
        RadGrid1.Rebind()
    End If
End Sub

See Also

In this article