Good Afternoon,
I have a radgrid on a usercontrol, that is called by a parent page. For some reason the export function will not work inside the usercontrol, but the same code will work perfect if I place it directly on the parent page.
Here is my javascript located on the Default.aspx page:
Here is the grid that will export correctly if the code is placed on the parent page:
But if I place the same code in a usercontrol and then place the usercontrol on the Default.aspx page, the data will not export. What else am I missing, I have gone all through the sample code and haven't been able to figure it out?
Thanks,
Ronnie
I have a radgrid on a usercontrol, that is called by a parent page. For some reason the export function will not work inside the usercontrol, but the same code will work perfect if I place it directly on the parent page.
Here is my javascript located on the Default.aspx page:
| <script type="text/javascript"> |
| function pnlRequestStarted(ajaxPanel, eventArgs) |
| { |
| if(eventArgs.EventTarget == "pnlBtnExcel" || eventArgs.EventTarget == "pnlBtnWord") |
| { |
| eventArgs.EnableAjax = false; |
| } |
| } |
| </script> |
Here is the grid that will export correctly if the code is placed on the parent page:
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="pnlRequestStarted"> |
| <asp:Button ID="pnlBtnExcel" Width="150px" Text="Export to Excel" OnClick="btnExcel_Click" |
| runat="server" /> |
| <asp:Button ID="pnlBtnWord" Width="150px" Text="Export to Word" OnClick="btnWord_Click" |
| runat="server" /> |
| <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None"> |
| <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" |
| SortExpression="ID" UniqueName="ID"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name" |
| UniqueName="Name"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Value" HeaderText="Value" SortExpression="Value" |
| UniqueName="Value"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" |
| SelectCommand="SELECT * FROM [Test]"></asp:SqlDataSource> |
| </telerik:RadAjaxPanel> |
But if I place the same code in a usercontrol and then place the usercontrol on the Default.aspx page, the data will not export. What else am I missing, I have gone all through the sample code and haven't been able to figure it out?
Thanks,
Ronnie