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

PDF file shows header in each page

3 Answers 34 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Meenakshi
Top achievements
Rank 1
Meenakshi asked on 30 May 2012, 09:50 AM
Hi,

I am trying to export the radgrid content to a pdf file. My grid has hierarchy data. In the PDF file, the header is getting attached in each page. How do i overcome this issue. I made the header not to show up for each level but irrespective of that i am seeing the header. Attached the file for reference. 

Regards,
Meenakshi Sekar. 

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 04 Jun 2012, 10:56 AM
Hi,

In order to achieve your goal you could use the following code:

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridHeaderItem)
        {
            e.Item.Visible = false;
        }
    }

This code will clear all the headers from exporting. If you want to leave the headers from the MasterTableView you could add a Name attribute to it and check for it in the ItemDataBound event:

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridHeaderItem && e.Item.OwnerTableView.Name=="MasterTableView")
        {
            e.Item.Visible = false;
        }
    }

Give this approach a try and check whether this is the expected behavior.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Meenakshi
Top achievements
Rank 1
answered on 05 Jun 2012, 05:57 AM
Thanks it worked for me. But it displays lines in the second page of the PDF. It doesnt display the header. But the lines are displayed. 

Attached for your reference. 

Regards,
Meenakshi Sekar. 
0
Andrey
Telerik team
answered on 05 Jun 2012, 10:33 AM
Hi,

Most probably the problem comes from the borders, you could try using the following code in order to remove the borders as well:

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridHeaderItem)
    {
        e.Item.Visible = false;
        e.Item.Style["border"] = "0 none";
    }
}

If this does not help I will need a live URL to inspect in order to give you further assistance.

Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Meenakshi
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Meenakshi
Top achievements
Rank 1
Share this question
or