Export to Pdf does not open in a new window

6 posts, 0 answers
  1. newbie
    newbie avatar
    355 posts
    Member since:
    Feb 2008

    Posted 23 Aug 2010 Link to this post

     

    I have a grid with grouping and scrolling enabled.
    On export to pdf the grid is not exported in a new page. instead it loads the data in the grid.
    I have the export functionality working as desired on other pages in the app. It gives a prompt to save or open the export. But with the grid I am referring to it does not prompt, just loads the export data into the grid.

    I am using the latest Telerik Controls. Pasted below is my grid code:


    <telerik:RadGrid ID="RadGridCalendar" runat="server" GridLines="None" AllowPaging="true" PageSize="20"
                                AllowFilteringByColumn="true" Width="980px" ShowHeader="true" OnColumnCreated="RadGridCalendar_ColumnCreated"
                               OnItemCreated="RadGridCalendar_ItemCreated" OnItemDataBound="RadGridCalendar_ItemDataBound"
                               OnPreRender="RadGridCalendar_PreRender" AutoGenerateColumns="False" EnableLinqExpressions="false"
                               ShowGroupPanel="false" OnItemCommand="RadGridCalendar_ItemCommand" AllowSorting="true"
                               AllowCustomPaging="false" OnNeedDataSource="RadGridCalendar_NeedDataSource">
                               <ClientSettings Resizing-AllowColumnResize="true">
                                   <ClientEvents OnGridCreated="GridCreated" />
                                   <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="450px" />
                               </ClientSettings>
                               <ExportSettings IgnorePaging="false"  OpenInNewWindow="true" ExportOnlyData="false"
                                   FileName="CalendarExport">
                                   <Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"
                                       Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in"
                                       PageWidth="297mm" PageHeight="210mm" PageTopMargin="1in" PageTitle="Calendar"
                                       Subject="Calendar Export" Title="Calendar" />
                               </ExportSettings>
                               <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="true" ClientDataKeyNames="ActivityID"
                                   Width="100%" CommandItemDisplay="Top" DataKeyNames="ActivityID">
                                   <GroupByExpressions>
                                       <telerik:GridGroupByExpression>
                                           <SelectFields>
                                               <telerik:GridGroupByField FieldName="ToDoType" HeaderText=" " HeaderValueSeparator=""
                                                   FormatString="{0}" SortOrder="Ascending"></telerik:GridGroupByField>
                                           </SelectFields>
                                           <GroupByFields>
                                               <telerik:GridGroupByField FieldName="ToDoType"></telerik:GridGroupByField>
                                           </GroupByFields>
                                       </telerik:GridGroupByExpression>
                                       <telerik:GridGroupByExpression>
                                           <SelectFields>
                                               <telerik:GridGroupByField FieldName="ActivityDate"></telerik:GridGroupByField>
                                           </SelectFields>
                                           <GroupByFields>
                                               <telerik:GridGroupByField FieldName="Date" FormatString="{0:d}" SortOrder="Descending">
                                               </telerik:GridGroupByField>
                                               <telerik:GridGroupByField FieldName="ActivityDate" FormatString="{0:D}" SortOrder="None">
                                               </telerik:GridGroupByField>
                                           </GroupByFields>
                                       </telerik:GridGroupByExpression>
                                   </GroupByExpressions>
                                   <Columns>
                                       <telerik:GridTemplateColumn UniqueName="DateColumn" HeaderText="Date">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="72px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="TimeColumn" HeaderText="Time">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="125px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <%# DataBinder.Eval(Container.DataItem, "StartTime") %>
                                                   <asp:Label ID="Label1" runat="server" Visible='<%# !Convert.IsDBNull(Eval("EndTime")) %>'>-</asp:Label>
                                                   <%# DataBinder.Eval(Container.DataItem, "EndTime") %>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Subject" HeaderText="Subject">
                                           <ItemStyle BorderStyle="None" HorizontalAlign="Left"></ItemStyle>
                                           <HeaderStyle Width="250px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div style="text-align:left">
                                                   <asp:LinkButton ID="LinkButtonActivity" runat="server" ForeColor="#73abc9" Font-Size="9pt"
                                                       CommandName="ShowActivity" Font-Bold="true">
                                                   <%# Eval("Subject")%></asp:LinkButton>
                                                   <asp:Label ID="LabelSubject" runat="server" CssClass="label" Width="1px" Visible="false"><%# Eval("Subject")%></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Location" HeaderText="Location">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="125px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelLocation" runat="server" Text='<%# Eval("Location")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="DueDate" HeaderText="Due Date"  Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelDueDate" runat="server" Text='<%# Eval("DueDate")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Contact" HeaderText="Contact">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="125px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelContact" runat="server" Text='<%# Eval("Contact")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Description" HeaderText="Description">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="175px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelDescription" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Status" HeaderText="Status" Visible="false"
                                           DataField="Status" AllowFiltering="true">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelStatus" runat="server" Text='<%# Eval("Status")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Type" HeaderText="Type" Visible="false"
                                           AllowFiltering="true" DataField="Type">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelType" runat="server" Text='<%# Eval("Type")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="SubType" HeaderText="Sub-Type" Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelSubType" runat="server" Text='<%# Eval("SubType")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>                                    <telerik:GridTemplateColumn UniqueName="Priority" HeaderText="Priority" Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelPriority" runat="server" Text='<%# Eval("Priority")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Company" HeaderText="Company" Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelEmployer" runat="server" Text='<%# Eval("Employer")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="Phone" HeaderText="Phone" Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelPhone" runat="server" Text='<%# Eval("Phone")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                                                          <telerik:GridTemplateColumn UniqueName="TimeSpent" HeaderText="TimeSpent" Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelTimeSpent" runat="server" Text='<%# Eval("TimeSpent")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                       <telerik:GridTemplateColumn UniqueName="PercentComplete" HeaderText="% Complete"
                                           Visible="false">
                                           <ItemStyle BorderStyle="None"></ItemStyle>
                                           <HeaderStyle Width="100px" HorizontalAlign="Center" />
                                           <ItemTemplate>
                                               <div>
                                                   <asp:Label ID="LabelPercentComplete" runat="server" Text='<%# Eval("PercentComplete")%>'></asp:Label>
                                               </div>
                                           </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                                                          <telerik:GridBoundColumn DataField="ActivityID" Visible="false" UniqueName="ActivityID">
                                       </telerik:GridBoundColumn>
                                       <telerik:GridDateTimeColumn DataField="Date" AllowFiltering="true" Visible="false"
                                           DataFormatString="{0:MM/dd/yyyy}" UniqueName="Date">
                                       </telerik:GridDateTimeColumn>
                                                                                          </Columns>
                                   <HeaderStyle Width="100px" />
                                   <CommandItemTemplate>                                
                                       <asp:ImageButton ID="ImageButtonAdd" runat="server" ImageUrl="~/App_Themes/MLightning/Layout/plus-icon.png"
                                           AlternateText="Add" PostBackUrl="~/Calendar/CalendarActivityAddSettings.aspx" /> 
                                       <asp:LinkButton ID="LinkButtonExport" runat="server" CommandName="ExportToPdf" CausesValidation="false">
                                       <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/MLightning/Layout/Reader.gif" />
                                       <span class="printTop" > Export</span>
                                       </asp:LinkButton>  
                                   </CommandItemTemplate>
                                     
                                   <PagerStyle Position="TopAndBottom" PrevPageText="Prev" NextPageText="Next" Mode="NextPrev" />
                               </MasterTableView>
                           </telerik:RadGrid>

    Please let me know what I need to do for the export to open in a new window and give the user a prompt.
  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 24 Aug 2010 Link to this post

    Hello,

    Please make sure that the control that initiates the export is NOT ajaxified.
    Export from ajaxified grid

    I hope this helps.

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. newbie
    newbie avatar
    355 posts
    Member since:
    Feb 2008

    Posted 26 Aug 2010 Link to this post

    I removed the RadGrid from RAdAJAXManager but it still behaves the same.
    I have other grids in the app that are used in a similar manner but the export works just fine on them.

    Below is my page declaration :

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
        CodeFile="SOCalendar.aspx.cs" Inherits="SOCalendar" %>
      
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderContent" runat="Server">
        <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        </asp:ScriptManagerProxy>
        <telerik:RadAjaxManagerProxy ID="RadAJAXManagerProxy1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBoxCalendarFor">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxCalendarFor" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxStatus" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxParticipantLevel" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBoxDateRange">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxCalendarFor" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxType" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxStatus" />
                        <telerik:AjaxUpdatedControl ControlID="DateLabel" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxParticipantLevel" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBoxType">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxCalendarFor" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxType" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxStatus" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxParticipantLevel" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBoxStatus">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxCalendarFor" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxType" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxStatus" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxParticipantLevel" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBoxParticipantLevel">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxCalendarFor" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxType" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxStatus" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxParticipantLevel" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
              
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ButtonToday">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ButtonToday" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="DateLabel" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBoxDateRange" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ButtonNext">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ButtonNext" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="DateLabel" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ButtonBack">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ButtonBack" />
                        <telerik:AjaxUpdatedControl ControlID="dummyTextBox" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="DateLabel" />
                        <telerik:AjaxUpdatedControl ControlID="RadGridCalendar" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      
            <script type="text/javascript">
                window.history.forward(1);
                var supressDropDownClosing = false;
      
                function OnClientDropDownClosing(sender, eventArgs) {
                    eventArgs.set_cancel(supressDropDownClosing);
                }
      
                function OnClientSelectedIndexChanging(sender, eventArgs) {
                    eventArgs.set_cancel(supressDropDownClosing);
                }
      
                function OnClientDropDownOpening(sender, eventArgs) {
                    supressDropDownClosing = true;
                }
      
                function OnClientBlur(sender) {
                    supressDropDownClosing = false;
      
                    sender.toggleDropDown();
                }
      
      
                function stopPropagation(e, chk) {
                    e.cancelBubble = true;
                    if (e.stopPropagation) {
                        e.stopPropagation();
                    }
      
                    var comboID = chk.id.replace(/_i(\d+)_CheckBox1$/, "");
                    var combo = $find(comboID);
      
                    var selectedItemsTexts = "";
                    var selectedItemsValues = "";
      
                    var items = combo.get_items();
                    for (var i = 0; i < items.get_count(); i++) {
                        var item = items.getItem(i);
                        var checkbox = item.get_element().getElementsByTagName("input")[0];
                        if (checkbox.checked) {
                            selectedItemsTexts += item.get_text() + ", ";
                            selectedItemsValues += item.get_value() + ", ";
                        }
                    }
      
                    selectedItemsTexts = selectedItemsTexts.substring(0, selectedItemsTexts.length - 2);
                    selectedItemsValues = selectedItemsValues.substring(0, selectedItemsValues.length - 2);
      
      
                    combo.set_text(selectedItemsTexts);
      
                    //Clear the selection that RadComboBox has made internally.
                    if (selectedItemsValues == "") {
                        combo.clearSelection();
                    }
                }
      
                function GridCreated(sender, args) {
                    var scrollArea = sender.GridDataDiv;
                    var dataHeight = sender.get_masterTableView().get_element().clientHeight;
                    if (dataHeight < 350) {
                        scrollArea.style.height = dataHeight + 17 + "px";
                    }
      
                    sender.get_masterTableView().hideFilterItem();
                }
      
                //            function pageLoad(sender, eventArgs) {
                //                if (!eventArgs.get_isPartialLoad()) {
                //                    $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("InitialPageLoad");
                //                }
                //            } 
      
            </script>
      
        </telerik:RadCodeBlock>
        <style type="text/css">
            /*used for demonstration purposes only.The group expand/collapse icons should be hidden like in the help topic*/.rgExpand, .rgCollapse
            {
                display: none !important;
            }
            /*remove group splitter column padding*/.rgGroupCol
            {
                border: none 0px !important;
            }
        </style>
        <br />
        <div style="width: 100%; text-align: center;">
            <table border="0" cellspacing="0" class="calendar" style="margin: 0px !important;
                padding: 0px !important; width: 980px; table-layout: fixed; border-style: none;
                text-align: left;">
                <tr>
                    <td colspan="8">
                        <br />
                    </td>
                </tr>
                <tr>
                    <th colspan="8" style="height: 23px; text-align: left; background: gray; width: 980px">
                        <table width="980px">
                            <tr>
                                <td style="color:White; font-size: 10pt; width: 100px; vertical-align:middle">
                                    User Calendar  
                                </td>
                                <td style="width: 200px">
                                    <telerik:RadComboBox runat="server" ID="RadComboBoxCalendarFor" Width="175px" OnPreRender="RadComboBoxCalendarFor_PreRender"
                                        OnSelectedIndexChanged="RadComboBoxCalendarFor_SelectedIndexChanged" AllowCustomText="true"
                                        AutoPostBack="true" HighlightTemplatedItems="true">
                                    </telerik:RadComboBox>
                                </td>
                                <td style="width: 650px; vertical-align:middle">
                                    <asp:Label ID="DateLabel" runat="server" ForeColor="White"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </th>
                </tr>
                <tr style="background-color: #a7a7a9;">
                    <td colspan="8" style="height: 23px;">
                        <table width="980px" >
                            <tr>
                                <td style="color: Black; text-align: right; vertical-align:middle">
                                    Date Range
                                </td>
                                <td style="text-align: left;vertical-align:middle">
                                    <table cellpadding="0">
                                        <tr>
                                            <td style="vertical-align:middle">
                                                <telerik:RadComboBox runat="server" ID="RadComboBoxDateRange" AllowCustomText="true"
                                                    AutoPostBack="true" OnSelectedIndexChanged="RadComboBoxDateRange_SelectedIndexChanged"
                                                    Width="55px" LoadingMessage="loading..">
                                                    <Items>
                                                        <telerik:RadComboBoxItem Text="Day" Value="Day" />
                                                        <telerik:RadComboBoxItem Text="Week" Value="Week" Selected="true" />
                                                        <telerik:RadComboBoxItem Text="Month" Value="Month" />
                                                    </Items>
                                                    <CollapseAnimation Type="outquint" Duration="200"></CollapseAnimation>
                                                </telerik:RadComboBox>
                                            </td>
                                            <td style="vertical-align:middle">
                                                <asp:Button runat="server" ID="ButtonToday" BorderStyle="None" Text="Today" Width="45px"
                                                    Font-Names="Tahoma" Font-Size="9pt" OnClick="ButtonToday_Click" />
                                            </td>
                                            <td style="vertical-align:middle">
                                                <asp:Button runat="server" ID="ButtonBack" BorderStyle="None" Text="<" Width="20px"
                                                    Font-Names="Tahoma" Font-Size="9pt" Font-Bold="true" BackColor="gray" ForeColor="White"
                                                    OnClick="ButtonBack_Click" />
                                            </td>
                                            <td style="vertical-align:middle">
                                                <asp:Button runat="server" ID="ButtonNext" BorderStyle="None" Text=">" Width="20px"
                                                    Font-Names="Tahoma" Font-Size="9pt" Font-Bold="true" BackColor="gray" ForeColor="White"
                                                    OnClick="ButtonNext_Click" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td style="color: Black; text-align: right; vertical-align:middle">
                                    Activity Type
                                </td>
                                <td style="text-align: left; vertical-align:middle">
                                    <telerik:RadComboBox runat="server" ID="RadComboBoxType" Width="150px" AllowCustomText="true"
                                        AutoPostBack="true" HighlightTemplatedItems="true" OnClientDropDownOpening="OnClientDropDownOpening"
                                        OnSelectedIndexChanged="RadComboBoxType_SelectedIndexChanged" OnClientDropDownClosing="OnClientDropDownClosing"
                                        OnClientSelectedIndexChanging="OnClientSelectedIndexChanging" OnClientBlur="OnClientBlur">
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox1" onclick="stopPropagation(event, this);"
                                                Text='<%# DataBinder.Eval(Container, "Text") %>' />
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
                                </td>
                                <td style="color: Black; text-align: right; vertical-align:middle">
                                    Status
                                </td>
                                <td style="text-align: left; vertical-align:middle">
                                    <telerik:RadComboBox runat="server" ID="RadComboBoxStatus" Width="130px" AllowCustomText="true"
                                        AutoPostBack="true" HighlightTemplatedItems="true" OnClientDropDownOpening="OnClientDropDownOpening"
                                        OnSelectedIndexChanged="RadComboBoxStatus_SelectedIndexChanged" OnClientDropDownClosing="OnClientDropDownClosing"
                                        OnClientSelectedIndexChanging="OnClientSelectedIndexChanging" OnClientBlur="OnClientBlur">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="Active" Value="Active" />
                                            <telerik:RadComboBoxItem Text="Cancelled" Value="Cancelled" />
                                            <telerik:RadComboBoxItem Text="Done" Value="Done" />
                                        </Items>
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox1" onclick="stopPropagation(event, this);"
                                                Text='<%# DataBinder.Eval(Container, "Text") %>' />
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
                                </td>
                                <td style="color: Black; text-align: right; vertical-align:middle">
                                    Participant Level
                                </td>
                                <td style="text-align: left; vertical-align:middle">
                                    <telerik:RadComboBox runat="server" ID="RadComboBoxParticipantLevel" Width="175px"
                                        AutoPostBack="true" AllowCustomText="true" HighlightTemplatedItems="true" OnClientDropDownOpening="OnClientDropDownOpening"
                                        OnSelectedIndexChanged="RadComboBoxParticipantLevel_SelectedIndexChanged" OnClientDropDownClosing="OnClientDropDownClosing"
                                        OnClientSelectedIndexChanging="OnClientSelectedIndexChanging" OnClientBlur="OnClientBlur">
                                        <Items>
                                            <telerik:RadComboBoxItem Text="Primary Participant" Value="Primary Participant" />
                                            <telerik:RadComboBoxItem Text="Participant" Value="Participant" />
                                            <telerik:RadComboBoxItem Text="Activity I Created" Value="Activity I Created" />
                                        </Items>
                                        <ItemTemplate>
                                            <asp:CheckBox runat="server" ID="CheckBox1" onclick="stopPropagation(event, this);"
                                                Text='<%# DataBinder.Eval(Container, "Text") %>' />
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td colspan="8" style="text-align: left; vertical-align: middle; font-size: 11pt">
                        <div style="display: block; width: 980px !important; margin: 0px !important; padding: 0px !important">
                            <telerik:RadGrid ID="RadGridCalendar" runat="server" GridLines="None" AllowPaging="true" 
                                PageSize="20" AllowFilteringByColumn="true" Width="980px" ShowHeader="true" OnColumnCreated="RadGridCalendar_ColumnCreated"
                                OnItemCreated="RadGridCalendar_ItemCreated" OnItemDataBound="RadGridCalendar_ItemDataBound"
                                OnPreRender="RadGridCalendar_PreRender" AutoGenerateColumns="False" EnableLinqExpressions="false"
                                ShowGroupPanel="false" OnItemCommand="RadGridCalendar_ItemCommand" AllowSorting="false"
                                AllowCustomPaging="false" OnNeedDataSource="RadGridCalendar_NeedDataSource">
                                <ClientSettings Resizing-AllowColumnResize="true" >
                                    <ClientEvents OnGridCreated="GridCreated" />
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="450px" />
                                </ClientSettings>
                                <ExportSettings IgnorePaging="false"  OpenInNewWindow="true" ExportOnlyData="false"
                                    FileName="CalendarExport">
                                    <Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"
                                        Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in"
                                        PageWidth="297mm" PageHeight="210mm" PageTopMargin="1in" PageTitle="Calendar"
                                        Subject="Calendar Export" Title="Calendar" />
                                </ExportSettings>
                                <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="true" ClientDataKeyNames="ActivityID"
                                    Width="100%" CommandItemDisplay="Top" DataKeyNames="ActivityID">
                                    <GroupByExpressions>
                                        <telerik:GridGroupByExpression>
                                            <SelectFields>
                                                <telerik:GridGroupByField FieldName="ToDoType" HeaderText=" " HeaderValueSeparator=""
                                                    FormatString="{0}" SortOrder="Ascending"></telerik:GridGroupByField>
                                            </SelectFields>
                                            <GroupByFields>
                                                <telerik:GridGroupByField FieldName="ToDoType"></telerik:GridGroupByField>
                                            </GroupByFields>
                                        </telerik:GridGroupByExpression>
                                        <telerik:GridGroupByExpression>
                                            <SelectFields>
                                                <telerik:GridGroupByField FieldName="ActivityDate"></telerik:GridGroupByField>
                                            </SelectFields>
                                            <GroupByFields>
                                                <telerik:GridGroupByField FieldName="Date" FormatString="{0:d}" SortOrder="Descending">
                                                </telerik:GridGroupByField>
                                                <telerik:GridGroupByField FieldName="ActivityDate" FormatString="{0:D}" SortOrder="None">
                                                </telerik:GridGroupByField>
                                            </GroupByFields>
                                        </telerik:GridGroupByExpression>
                                    </GroupByExpressions>
                                    <Columns>
                                        <telerik:GridTemplateColumn UniqueName="DateColumn" HeaderText="Date">
                                            <ItemStyle BorderStyle="None"></ItemStyle>
                                            <HeaderStyle Width="72px" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <div>
                                                </div>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn UniqueName="TimeColumn" HeaderText="Time">
                                            <ItemStyle BorderStyle="None"></ItemStyle>
                                            <HeaderStyle Width="125px" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <div>
                                                    <%# DataBinder.Eval(Container.DataItem, "StartTime") %>
                                                    <asp:Label ID="Label1" runat="server" Visible='<%# !Convert.IsDBNull(Eval("EndTime")) %>'>-</asp:Label>
                                                    <%# DataBinder.Eval(Container.DataItem, "EndTime") %>
                                                </div>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn UniqueName="Subject" HeaderText="Subject">
                                            <ItemStyle BorderStyle="None" HorizontalAlign="Left"></ItemStyle>
                                            <HeaderStyle Width="250px" HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <div style="text-align:left">
                                                    <asp:LinkButton ID="LinkButtonActivity" runat="server" ForeColor="#73abc9" Font-Size="9pt"
                                                        CommandName="ShowActivity" Font-Bold="true">
                                                    <%# Eval("Subject")%></asp:LinkButton>
                                                    <asp:Label ID="LabelSubject" runat="server" CssClass="label" Width="1px" Visible="false"><%# Eval("Subject")%></asp:Label>
                                                </div>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                                                                                                                                                        <telerik:GridBoundColumn DataField="ActivityID" Visible="false" UniqueName="ActivityID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridDateTimeColumn DataField="Date" AllowFiltering="true" Visible="false"
                                            DataFormatString="{0:MM/dd/yyyy}" UniqueName="Date">
                                        </telerik:GridDateTimeColumn>
                                                                         </Columns>
                                    <HeaderStyle Width="100px" />
                                    <CommandItemTemplate>                                
                                        <asp:ImageButton ID="ImageButtonAdd" runat="server" ImageUrl="~/App_Themes/MLightning/Layout/plus-icon.png"
                                            AlternateText="Add" PostBackUrl="~/Calendar/CalendarActivityAddSettings.aspx" /> 
                                        <asp:LinkButton ID="LinkButtonExport" runat="server" CommandName="ExportToPdf" CausesValidation="false">
                                        <img style="border:0px;vertical-align:middle;" alt="" src="../App_Themes/MLightning/Layout/Reader.gif" />
                                        <span class="printTop" > Export</span>
                                        </asp:LinkButton>  
                                    </CommandItemTemplate>
                                      
                                    <PagerStyle Position="TopAndBottom" PrevPageText="Prev" NextPageText="Next" Mode="NextPrev" />
                                </MasterTableView>
                            </telerik:RadGrid>
                        </div>
                    </td>
                </tr>
                <tr style="width: 980px">
                    <td colspan="8" align="center">
                        <br />
                           
                        <asp:Button ID="btnCancel" runat="server" OnClientClick="location.href='../Lookup.aspx';return false;"
                            Text="Cancel" />
                        <asp:TextBox ID="dummyTextBox" BorderColor="White" BorderStyle="None" runat="server"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </div>
    </asp:Content>

    Please let me know if I need to provide more info.
  4. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 01 Sep 2010 Link to this post

    Hello,

    I examined the provided code but it doesn't indicate whether the exporting button is ajaxified or not.
    I recommend that you perform a global search to find all AJAX controls (UpdatePanel, RadAjaxManager, RadAjaxPanel)

    You can temporary disable AJAX (for testing purposes) if you set EnableAJAX="false" to RadAjaxPanel or RadAjaxManager (the manager, not the proxy).
    <telerik:RadAjaxManager
       ID="RadAjaxManager1"
       runat="server"
       EnableAJAX="false">
    ...

    If the problem still persists, please attach your project to a regular support ticket and I will debug it on my end.

    Regards,
    Daniel
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. prateek
    prateek avatar
    4 posts
    Member since:
    May 2017

    Posted 17 Jul 2017 Link to this post

    Hi You can do this simply by applying event -  OnClientClick="aspnetForm.target ='_blank';" 

     <asp:Button ID="exportPDF" runat="server" target="blank" Text="Export PDF" OnClientClick="aspnetForm.target ='_blank';" CssClass="btn btn-info" />

  6. Tom
    Tom avatar
    49 posts
    Member since:
    Oct 2010

    Posted 13 Dec 2019 Link to this post

    Two notes on @prateek's comment.

    1. Use your form's ID in the OnClientClick value (e.g., "form1.target='_blank';" if your form has the ID form1).

    2. In my scenario I have two buttons: one export to PDF and one export to Excel. I set the OnClientClick value only to the PDF button. If I load the page and click "Export to PDF" and then "Export to Excel", both will open in a new browser tab. If I load the page and click on "Export to Excel" first, it does not open a new browser tab. Go figure.

Back to Top