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

Unable Export To PDF with a FilterTemplate

2 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mano Sadeh
Top achievements
Rank 1
Mano Sadeh asked on 10 Jan 2014, 06:43 PM

Hey,


We have a Grid with a few columns that we want to filter with the unique values from the field. We are using a FilterTemplate to do it (based on example from Telerik). The filtering is working fine, but when we are trying to export to PDF we are getting this error:

Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'



Also, when exporting to excel you can see the attached screenshot from the output file.



This is the FilterTemplate content:



<FilterTemplate>

 <telerik:RadComboBox ID="cboStatus1" DataSourceID="sdsStatus" DataTextField="STATUSDESCRIPTION"

  DataValueField="STATUSDESCRIPTION" Height="100px"

  AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("STATUSDESCRIPTION").CurrentFilterValue %>'

  runat="server" OnClientSelectedIndexChanged="Assessment_StatusIndex"

  Skin="Metro">

  <Items>

   <telerik:RadComboBoxItem Text="All" />

  </Items>

 </telerik:RadComboBox>

 <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">

  <script type="text/javascript">

   function Assessment_StatusIndex(sender, args) {

    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");

    tableView.filter("STATUSDESCRIPTION", args.get_item().get_value(), "EqualTo");

   }

  </script>

 </telerik:RadScriptBlock>

</FilterTemplate>



Thanks,

Mano



2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Jan 2014, 06:19 AM
Hi,

Please try setting the  ExportSettings property ExportOnlyData to true as shown below.

ASPX:
<ExportSettings ExportOnlyData="true"></ExportSettings>

OR

You can set this property only on pdf export functionality as shown below.

C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.ExportToPdfCommandName)
    {
        RadGrid1.ExportSettings.ExportOnlyData = true;
    }
}

Thanks,
Shinu.

0
Mano Sadeh
Top achievements
Rank 1
answered on 20 Jan 2014, 06:54 PM
Thanks!!
Tags
Grid
Asked by
Mano Sadeh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mano Sadeh
Top achievements
Rank 1
Share this question
or