I have a gridview in a radgrid and I need to export the contents to a PDF. Everything but the nested gridview is exporting. When viewing the page, the grid is databound (but not when exporting to pdf). See code below:
<%@ Page Title=
""
Language=
"VB"
MasterPageFile=
"~/MasterPage-blank.master"
%>
<%@ Register assembly=
"Telerik.Web.UI"
namespace=
"Telerik.Web.UI"
tagprefix=
"telerik"
%>
<script runat=
"server"
>
Protected
Sub
Button1_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
RadGrid1.ExportSettings.ExportOnlyData =
False
RadGrid1.ExportSettings.IgnorePaging =
True
RadGrid1.ExportSettings.OpenInNewWindow =
False
RadGrid1.BorderStyle = BorderStyle.None
RadGrid1.MasterTableView.BorderStyle = BorderStyle.None
RadGrid1.MasterTableView.DataBind()
RadGrid1.MasterTableView.ExportToPdf()
End
Sub
</script>
<asp:Content ID=
"Content1"
ContentPlaceHolderID=
"head"
Runat=
"Server"
>
</asp:Content>
<asp:Content ID=
"Content2"
ContentPlaceHolderID=
"ContentPlaceHolder1"
Runat=
"Server"
>
<telerik:RadGrid ID=
"RadGrid1"
runat=
"server"
AutoGenerateColumns=
"False"
DataSourceID=
"SqlDataSource1"
GridLines=
"None"
>
<MasterTableView datakeynames=
"SchoolWalkID"
datasourceid=
"SqlDataSource1"
>
<Columns>
<telerik:GridTemplateColumn UniqueName=
"TemplateColumn"
>
<ItemTemplate>
This text exports to PDF. The grid below binds correctly when viewing the page a browser.
When
exporting to PDF, the grid is not exported.
<asp:GridView ID=
"GridView1"
runat=
"server"
AutoGenerateColumns=
"False"
DataSourceID=
"SqlDataSource2"
EnableModelValidation=
"True"
>
</asp:GridView>
<asp:SqlDataSource ID=
"SqlDataSource2"
runat=
"server"
ConnectionString=
"<%$ ConnectionStrings:SQLcmsConnection %>"
SelectCommand=
"SELECT * FROM [Schools]"
></asp:SqlDataSource>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:Button ID=
"Button1"
runat=
"server"
onclick=
"Button1_Click"
Text=
"Button"
/>
<asp:SqlDataSource ID=
"SqlDataSource1"
runat=
"server"
ConnectionString=
"<%$ ConnectionStrings:SQLcmsConnection %>"
SelectCommand=
"SELECT * FROM [Schools_Walks]"
></asp:SqlDataSource>
</asp:Content>