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

ExportToExcel as CommandItemTemplate Issue

1 Answer 132 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
GP asked on 06 Oct 2010, 09:36 PM
Hi.  I have a radgrid with a command item template.  I have Add New Record open a radwindow.  I have an imagebutton for export to excel, and I set it up like the demo suggests (, but instead of exporting, it hides the command items.  I am posting my code below.  Could you please let me know what I am doing wrong? 
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <script type="text/javascript">
                function onRequestStart(sender, args) {
                    if (args.get_eventTarget().indexOf("excelExport") > 0) {
                function ShowInsertForm() {
                    var combo = $find("<%= RadComboBox1.ClientID %>");
                    var comboItem = combo.get_selectedItem();
                    if (!comboItem)
                        window.radopen("AddComment.aspx", "UserListDialog");
                    else {
                        window.radopen("AddComment.aspx?something=" + comboItem.get_value("something"), "UserListDialog");
                    return false;
                function refreshGrid() {
                    $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
                        AllowPaging="True" AllowSorting="True" GridLines="None" Skin="WebBlue"
                        OnDataBound="RadGrid1_DataBound" width="873px"
                        <ExportSettings  ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                            <Excel Format="ExcelML" />
                        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                        <MasterTableView CommandItemDisplay="Top" >
                            <CommandItemSettings >
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <HeaderStyle Width="20px"></HeaderStyle>
                                <telerik:GridBoundColumn DataField="something0" HeaderText="Grantee"
                                <telerik:GridBoundColumn DataField="something" HeaderText="PO" UniqueName="column1">
                                <telerik:GridBoundColumn DataField="something1" FilterControlWidth="30px"
                                    HeaderText="Comment Date" UniqueName="column2">
                                <telerik:GridBoundColumn DataField="something2" HeaderText="Commentor"
                                <telerik:GridBoundColumn DataField="something3" HeaderText="Comment"
                                <telerik:GridBoundColumn DataField="InsertDate" FilterControlWidth="30px"
                                    HeaderText="Insert Date" UniqueName="something4">
                                <a href="#" onclick="return ShowInsertForm();">Add New Record</a>
                                <asp:ImageButton ID="excelExport" runat="server" ImageUrl="~/images/ExportToExcel.gif" CommandName="ExportToExcel" />

Thank you.

1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 07 Oct 2010, 05:28 PM
Nevermind.  After much "Bang Head Here", I saw a silly little mistake that I looked over.  I forgot to add the following tag to the AJAX Manager:
<ClientEvents OnRequestStart="onRequestStart" />

For anyone else looking for this...check the export to Excel demo's AJAX manager.

Simple, but easy to miss when setting things up.
Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question