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

Exporting Grid on client through a context menu

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dwayne
Top achievements
Rank 1
Dwayne asked on 30 Aug 2009, 08:42 PM
I am trying to export a grid on the client by using a context menu.  The grid has an ajax manager on it so when I click the export option it starts an ajax request and never does the export.   When i used a button i would  have this code in place to stop the request.

 

if (args.get_eventTarget().indexOf("DownloadPDF") > 0)

 

args.set_enableAjax(

false);

 



but the export option is part of the context menu the event target is the grid.
I am trying to find a way to detect that the context menu was fired and the value while  canceling the ajax requests on the grid for  those values and fire the ajax on others.


you have to stop the request on the ajax manager  like this

ClientEvents-OnRequestStart

 

="requestStart"

 


I just need to find how to find child controls of the requesting event


2 Answers, 1 is accepted

Sort by
0
Dwayne
Top achievements
Rank 1
answered on 31 Aug 2009, 11:10 AM
I  have figured out how to do this on the server  iniating the  request on the client by call

 

var ajaxManager = $find("ctl00_MainSubContent_RADGRID1_RadAjaxManager1");

 

ajaxManager.ajaxRequestWithTarget(

 

 

 

 

'ctl00$MainSubContent$Page$ExcelButton', '');

but the issue with this is the buttons that you call must be visible on the page usless the request goes nowhere so now i'm left with a context menu that can download Word ,Excel,Pdf but i also have 3 buttons hanging out ont he page which i don't want.

 Iam trying to figure out how to kill the ajax request on the grid when certain context menu selections are selected and to use ajax when other are clicked.


this is my context menu

 

 

<telerik:RadContextMenu ID="RadMenu1" runat="server" OnClientItemClicked="getWindow" Skin="Black" CssClass="contextmenu">

 

 

 

<Items 

 

 

 

<telerik:RadMenuItem Text="Modify"> 

 

 

 

 

<Items>

 

 

 

 

 <telerik:RadMenuItem Text="Add"   />

 

 

 

 

 <telerik:RadMenuItem Text="Edit"   />

 

 

 

 

  </Items>

 

 

 

 

</telerik:RadMenuItem>

 

 

 

 

<telerik:RadMenuItem Text="Medical"  />

 

 

 

 

<telerik:RadMenuItem Text="Personel Details" />

 

 

 

 

<telerik:RadMenuItem Text="Certificates"  />

 

 

 

 

 <telerik:RadMenuItem Text="Issued Items" />

 

 

 

 

 <telerik:RadMenuItem Text="Export To">

 

 

 

 

 <Items>

 

 

 

 

  <telerik:RadMenuItem Text="Word"     Value="Word" />

 

 

 

 

 <telerik:RadMenuItem Text="Excel" Value="Excel" />

 

 

 

 

<telerik:RadMenuItem Text="Pdf" Value="Pdf" />

 

 

 

 

</Items>

 

 

 

 

</telerik:RadMenuItem>

 

 

  

 

</Items>

 

 

 

 

</telerik:RadContextMenu>

 

 

 

 

 

 

 

 
the getwindow methods does various thing based on the menu selection

 

 

 

 

0
Accepted
Sebastian
Telerik team
answered on 02 Sep 2009, 04:12 PM
Hello Dwayne,

I think that the last projects posted in the code library entry here can help you disable the ajax  and export the grid content only when certain items in the context menu are clicked.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Dwayne
Top achievements
Rank 1
Answers by
Dwayne
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or