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

Export Radgrid in masterpage with and Updatepanel

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 05 Apr 2012, 06:16 PM
I have looked at the examples I could find but do not find one with a masterpage and updatepanel involved.  How can I export to excel within a masterpage and updatepanel.  If I have the updatepanel out of the following code it works but when put back in it does nto work, but produces no errors either.  Originally I tried to use one update panel but switched to 2 to see if I could get it to work this way. still no deal.

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyContent" Runat="Server">
    <asp:UpdatePanel ID="udp1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="lnkDisplay" />
        </Triggers>
        <ContentTemplate>
             <asp:Panel ID="pnlPick" Runat="server">
                <table width="100%">
                    <tr>
                        <td align="center" width="100%">Pick Deployment: 
                            <asp:DropDownList id="ddlDeployment" Runat="server" Width="160" AutoPostBack="True"></asp:DropDownList>     
                            Pick BN: <asp:DropDownList id="ddlBn" Runat="server" Width="120" AutoPostBack="True"></asp:DropDownList>
                                 Pick Uic: <asp:DropDownList id="ddlUic" Runat="server" Width="120" AutoPostBack="true"></asp:DropDownList>
                            <asp:Button ID="btnPanel" runat="server" style="display:none" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center"><asp:LinkButton ID="lnkDisplay" Runat="server" CausesValidation="True">Display DMD</asp:LinkButton></td>
                    </tr>
                    <tr>
                        <td style="height:10px"></td>
                    </tr>
                </table>
            </asp:Panel>
       </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="udp2" runat="server">
        <ContentTemplate>
            <asp:Panel ID="pnlgrid" runat="server" Visible="false">
                <table width="100%">
                    <tr>
                        <td align="center">
                             <telerik:RadGrid ID="myRadGrid" runat="server" Width="98%" BorderWidth="1px" CellPadding="6" GridLines="None" BorderColor="#404040" Skin="Web20">
                                <ExportSettings ExportOnlyData="true" FileName="DonorSlots" IgnorePaging="true" OpenInNewWindow="true"></ExportSettings>
                                <MasterTableView AutoGenerateColumns="false" Name="MasterGrid" BorderColor="#404040" Font-Size="9" Font-Names="Veranda,arial,sans-serif" 
                                HeaderStyle-HorizontalAlign="Center" GridLines="Both" BorderWidth="1px" CommandItemDisplay="Top" EditMode="EditForms">
                                <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToExcelButton="false" /><AlternatingItemStyle BackColor="#B0C4DE"  HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Center" /><HeaderStyle ForeColor="White" Font-Bold="true" BorderColor="#404040" BorderWidth="1px" />
                                    <CommandItemTemplate>
                                        <table width="100%">
                                            <tr>
                                                <td align="right"><asp:Button ID="btnExport" runat="server" CommandName="ExportToExcel" Text="Export Excel" /></td>
                                            </tr>
                                        </table>
                                    </CommandItemTemplate>
                                   <Columns>
                                    <telerik:GridBoundColumn DataField="Unit" HeaderText="Unit" />
                                    <telerik:GridBoundColumn DataField="Para\Line\Pos" HeaderText="Para\Line\Pos" />
                                    <telerik:GridBoundColumn DataField="Posn_title" HeaderText="Posn_Title" />
                                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" />
                                    <telerik:GridBoundColumn DataField="Rank" HeaderText="Rank" />
                                    <telerik:GridBoundColumn DataField="SSN" HeaderText="SSN" />
                                    <telerik:GridBoundColumn DataField="Grade" HeaderText="Grade" />
                                    <telerik:GridBoundColumn DataField="DMOS" HeaderText="Duty_Posn" />
                                    <telerik:GridBoundColumn DataField="REQCLR" HeaderText="Req Clr" />
                                    <telerik:GridBoundColumn DataField="PassPortDT" HeaderText="Pass_Port_DT" />
                                    <telerik:GridBoundColumn DataField="MobDay" HeaderText="Mob Days Cottad" />
                                    <telerik:GridBoundColumn DataField="SCTYDT" HeaderText="Scty_Dt" />
                                    <telerik:GridBoundColumn DataField="PHY_EXAM_DT" HeaderText="Phy_Exam_DT" />
                                    <telerik:GridBoundColumn DataField="MRD\ETS" HeaderText="Ets\Mrd" />
                                    <telerik:GridBoundColumn DataField="SRP_DT" HeaderText="Srp_DT" />
                                    <telerik:GridBoundColumn DataField="CLS" HeaderText="Cls Trained" />
                                    <telerik:GridBoundColumn DataField="Profile" HeaderText="P3\P4 Profile" />
                                    <telerik:GridBoundColumn DataField="Cleared" HeaderText="Mmrp|Peb|Meb Cleared" />
                                    <telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" />
                                </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>


1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 10 Apr 2012, 08:52 AM
Hello,

Please note that the exporting feature of the control work with regular postbacks only and it could not function correctly with ajax request. In case you export from a Button that is nested in MS AJAX UpdatePanel, you should set this control as PostBackTrigger: Please refer to the help topic below which elaborates on this matter:
 http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html

I hope this helps.

Regards,
Maria Ilieva
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
Kevin
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or