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

Fail to show Export buttons

4 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Per
Top achievements
Rank 1
Per asked on 13 Sep 2013, 11:29 AM
Hi,

I'm following this example http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx#qsf-demo-source
and put the relevant code into my project.
I can't see the export buttons appearance!

I added this   
<script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportTo") >= 0) {
                args.set_enableAjax(false);
            }
        }
 </script>

and this in my Radgrid:

                <telerik:RadGrid ID="RadGrid3" runat="server" CellSpacing="0" AllowFilteringByColumn="True"
                    DataSourceID="dsMaterial" GridLines="None" AllowPaging="True" Skin="Default" AutoGenerateColumns="false" OnItemCommand="RadGrid3_ItemCommand">
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                    </ClientSettings>
                    <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                    </ExportSettings>
                    <MasterTableView DataSourceID="dsMaterial" DataKeyNames="IDMaterial">
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="IDMaterial" DataSourceID="dsMaterialExtra" runat="server" AllowFilteringByColumn="false">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="IDMaterial" MasterKeyField="IDMaterial">
                                    </telerik:GridRelationFields>
                                </ParentTableRelation>
                                <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
                                    ShowExportToCsvButton="true" ShowExportToPdfButton="true">
                                </CommandItemSettings>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="TopArticle" HeaderText="Top Article">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="MaterialGroup" HeaderText="Material Group">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Replaceability" HeaderText="Replaceability">
                                    </telerik:GridBoundColumn>
                                </Columns>
                            </telerik:GridTableView>
                        </DetailTables>
                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowExportToPdfButton="true" ShowExportToCsvButton="true"
                            ShowExportToExcelButton="true" ShowExportToWordButton="true" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"
                            Created="True">
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="OldNumber" FilterControlAltText="Filter OldNumber column"
                                HeaderText="Old material number" SortExpression="OldNumber" UniqueName="OldNumber"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="NewNumber" FilterControlAltText="Filter NewNumber column"
                                HeaderText="New material number" SortExpression="NewNumber" UniqueName="NewNumber"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" AutoPostBackOnFilter="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TopArticle" FilterControlAltText="Filter TopArticle column"
                                HeaderText="Top article" SortExpression="TopArticle" UniqueName="TopArticle"
                                AllowFiltering="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="MaterialGroup" FilterControlAltText="Filter MaterialGroup column"
                                HeaderText="Group" SortExpression="MaterialGroup" UniqueName="MaterialGroup"
                                AllowFiltering="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Replaceability" FilterControlAltText="Filter Replaceability column"
                                HeaderText="Replaceability" SortExpression="Replaceability" UniqueName="Replaceability"
                                AllowFiltering="false">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                        <PagerStyle PageSizeControlType="RadComboBox" />
                    </MasterTableView>
                    <PagerStyle PageSizeControlType="RadComboBox" />
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>

Code behind:

        protected void RadGrid3_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
                e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
                e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName ||
                e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
            {
                ConfigureExport();
            }
        }

        public void ConfigureExport()
        {
            //Do some further config here
        }



What is missing?

Cheers,
Per

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 13 Sep 2013, 11:35 AM
Hi,

Please add CommandItemDisplay="top"  in your code snippet for the export buttons to appear as shown below.

ASPX:
<MasterTableView CommandItemDisplay="Top" . . . >

Thanks,
Princy
0
Per
Top achievements
Rank 1
answered on 13 Sep 2013, 11:41 AM
Thanks princy,

I can see them now. However, when I press any of them nothing gets exported, nothing's happening at all.
Ideas?
When I inspect one of the buttons at runtime using Firebug I get this

<input type="submit" class="rgExpXLS" title="Export to Excel" id="ctl00_ContentPlaceHolder1_RadGrid3_ctl00_ctl02_ctl00_ExportToExcelButton" value=" " name="ctl00$ContentPlaceHolder1$RadGrid3$ctl00$ctl02$ctl00$ExportToExcelButton">


Thanks,
Per
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 13 Sep 2013, 12:23 PM
Hello,

Please try with the below code snippet.

Let me know if any concern.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ClientEvents OnRequestStart="onRequestStart"></ClientEvents>
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid3">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid3"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>





Thanks,
Jayesh Goyani
0
Per
Top achievements
Rank 1
answered on 13 Sep 2013, 01:00 PM
That did it, thanks!
Tags
Grid
Asked by
Per
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Per
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or