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

Export radgrid to excel and word wouldn't trigger

1 Answer 28 Views
ClientExportManager
This is a migrated thread and some comments may be shown as answers.
Sd
Top achievements
Rank 1
Sd asked on 19 Jul 2019, 08:08 AM

Hey guys, i have been coding a radgrid with the option to export the data as excel and word. That all works just fine also the export, but when i change visible true/false the export buttons suddenly will not trigger as the first time.

I have these export buttons inside a radpagelayout. The 3'rd button "btnAddP" has visibility change, so when i click it it will hide the export buttons. When the visibility is back to export buttons, they don't do anything when clicked. I wanted to hear some suggestions from you guys and maybe if someone have had the same issue and how to handle it properly. 

01.<Columns>
02.        <telerik:LayoutColumn Span="8">
03.          <telerik:RadPageLayout ID="rplRadgrid" runat="server">
04.            <telerik:LayoutRow>
05.              <Columns>
06.                <telerik:LayoutColumn Span="4">
07.                  <telerik:RadButton ID="ibtnExportAsExcel" runat="server" ToolTip="Excel" OnClick="ibtnExportAsExcel_Click" CssClass="Margin">
08.                    <Image ImageUrl="~/Images/filetype-tiny.xls.png" />
09.                  </telerik:RadButton>
10.                  <telerik:RadButton ID="ibtnExportAsWord" runat="server" ToolTip="Word"                         OnClick="ibtnExportAsWord_Click"
11.                    <Image ImageUrl="~/Images/filetype-tiny.doc.png" />
12.                  </telerik:RadButton>
13.                  <telerik:RadButton ID="btnAddP" runat="server" OnClick="btnAddParticipants_Click"
14.                    <Image ImageUrl="../Images/edit-tiny.png" />
15.                  </telerik:RadButton>
16.                </telerik:LayoutColumn>
17.              </Columns>
18.            </telerik:LayoutRow>

......

 

void ConfigureExport()
    {
      
      radgrid.ExportSettings.UseItemStyles =
      radgrid.ExportSettings.ExportOnlyData =
      radgrid.ExportSettings.IgnorePaging =
      radgrid.ExportSettings.OpenInNewWindow = true;
 
      radgrid.ExportSettings.FileName = Resources.c3.Export;
    }
protected void ibtnExportAsExcel_Click(object sender, EventArgs e)
  {
    ConfigureExport();
    radgrid.MasterTableView.ExportToExcel();
  }
 
  protected void ibtnExportAsWord_Click(object sender, EventArgs e)
  {
    ConfigureExport();
    radgrid.MasterTableView.ExportToWord();
  }

 

protected void btnAddP_Click(object sender, EventArgs e)
    {
      tmrChatBoard.Enabled = false;
      rplUpdateP.Visible = true;
      rplRadgrid.Visible = false;
 
    }

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 Jul 2019, 08:24 AM
Hi Sam,

Does the problem happen, if you:
- Replace the RadButton controls with regular asp:Button ones?
- Move the buttons outside the PageLayout control
- Hide the buttons on the client-side with style="display:none" and show them with style="display: inline"
- Remove any ajaxification from the page. If the buttons are ajaxified this may prevent the export.
- Put a debugger brake point in the Click server handler and checking whether the ConfigureExport is fired?

I hope that the above ideas will help you out with the debugging and find the reason for the problem.

Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ClientExportManager
Asked by
Sd
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or